...
1name: release
2on:
3 create:
4 tags:
5 - v*
6 push:
7 branches:
8 - main
9
10# Note the only differences between release and canary-release jobs are:
11# - only canary passes --overwrite flag
12# - the VERSION make variable passed to 'make dist checksum' is expected to
13# be "canary" if the job is triggered by a push to "main" branch. If the
14# job is triggered by a tag push, VERSION should be the tag ref.
15jobs:
16 release:
17 if: startsWith(github.ref, 'refs/tags/v')
18 runs-on: ubuntu-latest
19 steps:
20 - name: Checkout source code
21 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
22 with:
23 fetch-depth: 0
24
25 - name: Setup Go
26 uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # pin@5.0.0
27 with:
28 go-version: '1.22'
29
30 - name: Run unit tests
31 run: make test-coverage
32
33 - name: Build Helm Binaries
34 run: |
35 set -eu -o pipefail
36
37 make build-cross VERSION="${{ github.ref_name }}"
38 make dist checksum VERSION="${{ github.ref_name }}"
39
40 - name: Set latest version
41 run: |
42 set -eu -o pipefail
43
44 mkdir -p _dist_versions
45
46 # Push the latest semver tag, excluding prerelease tags
47 LATEST_VERSION="$(git tag | sort -r --version-sort | grep '^v[0-9]' | grep -v '-' | head -n1)"
48 echo "LATEST_VERSION=${LATEST_VERSION}"
49 echo "${LATEST_VERSION}" > _dist_versions/helm-latest-version
50 echo "${LATEST_VERSION}" > _dist_versions/helm3-latest-version
51
52 - name: Upload Binaries
53 uses: bacongobbler/azure-blob-storage-upload@50f7d898b7697e864130ea04c303ca38b5751c50 # pin@3.0.0
54 env:
55 AZURE_STORAGE_CONNECTION_STRING: "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}"
56 AZURE_STORAGE_CONTAINER_NAME: "${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}"
57 with:
58 source_dir: _dist
59 container_name: ${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}
60 connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
61 extra_args: '--pattern helm-*'
62
63 - name: Upload Version tag files
64 uses: bacongobbler/azure-blob-storage-upload@50f7d898b7697e864130ea04c303ca38b5751c50 # pin@3.0.0
65 env:
66 AZURE_STORAGE_CONNECTION_STRING: "${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}"
67 AZURE_STORAGE_CONTAINER_NAME: "${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}"
68 with:
69 overwrite: 'true'
70 source_dir: _dist_versions
71 container_name: ${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}
72 connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
73
74 canary-release:
75 runs-on: ubuntu-latest
76 if: github.ref == 'refs/heads/main'
77 steps:
78 - name: Checkout source code
79 uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
80
81 - name: Setup Go
82 uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # pin@5.0.0
83 with:
84 go-version: '1.22'
85
86 - name: Run unit tests
87 run: make test-coverage
88
89 - name: Build Helm Binaries
90 run: |
91 make build-cross
92 make dist checksum VERSION="canary"
93
94 - name: Upload Binaries
95 uses: bacongobbler/azure-blob-storage-upload@50f7d898b7697e864130ea04c303ca38b5751c50 # pin@3.0.0
96 with:
97 source_dir: _dist
98 container_name: ${{ secrets.AZURE_STORAGE_CONTAINER_NAME }}
99 connection_string: ${{ secrets.AZURE_STORAGE_CONNECTION_STRING }}
100 extra_args: '--pattern helm-*'
101 # WARNING: this will overwrite existing blobs in your blob storage
102 overwrite: 'true'
View as plain text