-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (77 loc) · 2.5 KB
/
tag-release.yml
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
name: semver tag
on:
push:
branches:
- main
permissions:
contents: write
attestations: write
packages: write
env:
CRUSOE_CSI_DRIVER_NAME: csi.crusoe.ai
jobs:
semver-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Git
run: |
git config user.name "crusoe-cloud"
git config user.email "[email protected]"
- name: Load versions from text file
run: |
source versions.env
echo "MAJOR_VERSION=${MAJOR_VERSION}" >> $GITHUB_ENV
echo "MINOR_VERSION=${MINOR_VERSION}" >> $GITHUB_ENV
- name: Calculate and set new version
run: |
chmod +x ./scripts/tag_semver.sh
./scripts/tag_semver.sh $MAJOR_VERSION $MINOR_VERSION ""
shell: bash
- name: Read version and push tag
run: |
source variables.env
echo "Calculated version: $RELEASE_VERSION"
source variables.env
git tag $RELEASE_VERSION
git push origin $RELEASE_VERSION
goreleaser:
needs: semver-tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
# Allow goreleaser to access older tag information.
fetch-depth: 0
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version-file: 'go.mod'
cache: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@72b6676b71ab476b77e676928516f6982eef7a41 # v5.3.0
id: import_gpg
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
args: release --clean
version: 2.1.x
env:
# GitHub sets the GITHUB_TOKEN secret automatically.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}