Repository navigation
92 lines (89 loc) · 3.53 KB
/
Copy pathrelease.yaml
File metadata and controls
92 lines (89 loc) · 3.53 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
name: "Release"
on:
workflow_dispatch: {}
repository_dispatch:
types:
- release
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
submodules: 'true'
token: ${{ secrets.ORG_GITHUB_TOKEN }}
- name: Fetch All Tags
run: git fetch --force --tags
- name: Set Release Version
id: version
run: |
echo "RELEASE_VERSION=$(date +v%Y.%-m.%-d)" >> $GITHUB_OUTPUT
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: 'src/go.mod'
- name: Cache Go modules
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Import GPG Key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Login to Public ECR
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
registry: public.ecr.aws
username: ${{ secrets.ECR_PUBLIC_AWS_ACCESS_KEY_ID }}
password: ${{ secrets.ECR_PUBLIC_AWS_SECRET_ACCESS_KEY }}
env:
AWS_REGION: us-east-1
- name: Set up QEMU
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- name: Ensure Changelog
run: |
git config user.name "OpsLevel Bots"
git config user.email "bots@opslevel.com"
if test -f ./.changes/${{ steps.version.outputs.RELEASE_VERSION }}.md
then
echo "Skip Changie..."
else
CHANGIE=$(cd src && go tool -n changie)
$CHANGIE batch ${{ steps.version.outputs.RELEASE_VERSION }}
$CHANGIE merge
git add .
git commit -m "Cut Release '${{ steps.version.outputs.RELEASE_VERSION }}'"
git push origin HEAD
fi
git tag -f ${{ steps.version.outputs.RELEASE_VERSION }} -m "Cut Release '${{ steps.version.outputs.RELEASE_VERSION }}'"
git push -f origin refs/tags/${{ steps.version.outputs.RELEASE_VERSION }}
- name: Ensure Release Does Not Exist
env:
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
run: |
gh release delete ${{ steps.version.outputs.RELEASE_VERSION }} || true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0
with:
args: release --clean --release-notes=../.changes/${{ steps.version.outputs.RELEASE_VERSION }}.md
workdir: ./src
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }}
- name: Report Release To OpsLevel
uses: opslevel/report-deploy-github-action/with-docker@v3.0.0
with:
integration_url: ${{ secrets.DEPLOY_INTEGRATION_URL }}
service: "opslevel_runner"