-
Notifications
You must be signed in to change notification settings - Fork 250
63 lines (56 loc) · 1.65 KB
/
on-release.yaml
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
name: Release CI
on:
push:
tags:
- 'v*.*.*'
- '!v*.*.*-rc*'
jobs:
validate:
runs-on: ubuntu-latest
name: Validate Release
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Validate Tag
run: |
node -e "if (!/^v\d+\.\d+\.\d+$/.test('${{ github.ref_name }}')) { console.error('Invalid version provided');process.exit(1);}"
- name: Validate VERSION
run: |
version=$(cat cmd/thor/VERSION)
tag="${{ github.ref_name }}"
tag="${tag#v}" # Remove the "v" prefix from the tag
if [ "$tag" != "$version" ]; then
echo "VERSION file does not match tag"
exit 1
fi
- name: Validate Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This step validates that the tag is an official release
run: |
prerelease=$(gh release view ${{ github.ref_name }} --json isPrerelease | jq -r '.isPrerelease')
if [ "$prerelease" != "false" ]; then
echo "Tag is not an official release"
exit 1
fi
publish-docker-image:
name: Publish Docker Image
uses: ./.github/workflows/publish-docker-images.yaml
secrets: inherit
needs:
- validate
permissions:
contents: read
packages: write
with:
environment: docker-publish
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ github.ref_name }}
type=raw,value=latest