Repository navigation
99 lines (96 loc) · 3.76 KB
/
Copy pathrelease.yml
File metadata and controls
99 lines (96 loc) · 3.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: goreleaser
on:
push:
tags:
- "*"
- "!*-nightly*"
workflow_dispatch:
inputs:
aviator_deployment_id:
description: "Database ID of deployment"
required: false
type: string
aviator_release_cut_commit_hash:
description: "Commit SHA, branch name, or tag of the HEAD to be built"
required: false
type: string
aviator_release_candidate_version:
description: "Name of the version (e.g., 0.2.0)"
required: false
type: string
jobs:
goreleaser:
runs-on: ubuntu-latest
environment: release
permissions:
contents: "write"
steps:
# Checkout has to come first: the notify-deploy steps below are a local
# action, so anything failing before this point reports nothing to Slack.
# fetch-depth 0 also brings tags, which goreleaser needs.
- name: checkout
uses: actions/checkout@v7
with:
ref: "${{ inputs.aviator_release_cut_commit_hash || github.ref }}"
fetch-depth: 0
persist-credentials: false
- uses: fjogeleit/http-request-action@f98bb26551cd1af7d3eb2674578a80754ece88db # v2.0.1
if: github.event_name == 'workflow_dispatch' && inputs.aviator_deployment_id != ''
with:
url: '${{ vars.AVIATOR_API_HOST }}/api/v1/sync-deploy-github-action'
method: 'POST'
bearerToken: ${{ secrets.AVIATOR_API_TOKEN }}
data: '{"deployment_id": "${{ inputs.aviator_deployment_id }}", "workflow_run_id": "${{ github.run_id }}"}'
- name: fetch tags
run: git fetch --force --tags
- name: create release tag
id: create_tag
if: github.event_name == 'workflow_dispatch' && inputs.aviator_release_candidate_version != ''
env:
RC_VERSION: ${{ inputs.aviator_release_candidate_version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
VERSION="${RC_VERSION%-rc*}"
git tag "v${VERSION}"
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git push origin "v${VERSION}"
echo "release_tag=v${VERSION}" >> "$GITHUB_OUTPUT"
- name: Notify release start
uses: ./.github/actions/notify-deploy
with:
webhook_url: ${{ secrets.SLACK_WEBHOOK_PROD_DEPLOY_UPDATES }}
state: start
subject: "av release"
version: ${{ steps.create_tag.outputs.release_tag || github.ref_name }}
- name: install go
uses: actions/setup-go@v7
with:
cache: false
go-version-file: go.mod
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
version: "~> v2"
args: release --clean
env:
GORELEASER_CURRENT_TAG: ${{ steps.create_tag.outputs.release_tag || github.ref_name }}
AVIATOR_CO_HOMEBREW_REPO_SSH_KEY: ${{ secrets.AVIATOR_CO_HOMEBREW_REPO_SSH_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FURY_TOKEN: ${{ secrets.FURY_PUSH_TOKEN }}
- name: Notify release success
uses: ./.github/actions/notify-deploy
with:
webhook_url: ${{ secrets.SLACK_WEBHOOK_PROD_DEPLOY_UPDATES }}
state: success
subject: "av release"
version: ${{ steps.create_tag.outputs.release_tag || github.ref_name }}
- name: Notify release failure
# This includes cancellation.
if: ${{ !success() }}
uses: ./.github/actions/notify-deploy
with:
webhook_url: ${{ secrets.SLACK_WEBHOOK_PROD_DEPLOY_UPDATES }}
state: failure
subject: "av release"
version: ${{ steps.create_tag.outputs.release_tag || github.ref_name }}