Skip to content

Commit 544561c

Browse files
committed
[release-v2.11] immutable release update
1 parent 753a062 commit 544561c

1 file changed

Lines changed: 56 additions & 10 deletions

File tree

.github/workflows/release.yaml

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
prime-username: ${{ env.PRIME_REGISTRY_USERNAME }}
6565
prime-password: ${{ env.PRIME_REGISTRY_PASSWORD }}
6666
make-target: image-push
67-
push-to-prime: true
67+
push-to-prime: ${{ !contains(github.ref_name, '-rc') }}
6868
- name: Cleanup checksum files # in order to avoid goreleaser dirty state error, remove once rancher/ecm-distro-tools/actions/publish-image@main gets updated
6969
run: rm -f slsactl_*_checksums.txt*
7070

@@ -79,16 +79,58 @@ jobs:
7979
with:
8080
fetch-depth: 0
8181
ref: ${{ github.ref_name }}
82-
- name: Create release
82+
- name: Setup goreleaser
83+
shell: bash
84+
run: |-
85+
OS="Linux"
86+
if [[ ${RUNNER_OS} != "Linux" ]]; then
87+
echo "Unsupported OS: ${RUNNER_OS}"
88+
exit 1
89+
fi
90+
91+
# renovate-local: goreleaser-x86_64
92+
GORELEASER_VERSION="v2.15.2"
93+
# renovate-local: goreleaser-x86_64=v2.15.2
94+
GORELEASER_CHECKSUM_x86_64="0ebdbf0353aba566b969dde746cc4e4806f96c27aa2f3971b229a9df7611fedc"
95+
96+
ARCH=$(uname -m)
97+
CHECKSUM="${GORELEASER_CHECKSUM_x86_64}"
98+
if [[ "${ARCH}" != "x86_64" ]]; then
99+
echo "Unsupported architecture: ${ARCH}"
100+
exit 1
101+
fi
102+
103+
FILE="goreleaser_${OS}_${ARCH}.tar.gz"
104+
105+
echo "Installing ${FILE}"
106+
curl -LO "https://github.com/goreleaser/goreleaser/releases/download/${GORELEASER_VERSION}/${FILE}"
107+
echo "${CHECKSUM} ${FILE}" | sha256sum -c
108+
tar -xf "${FILE}" goreleaser
109+
110+
if sudo -n true &> /dev/null; then
111+
sudo install -m 755 goreleaser /usr/local/bin/goreleaser
112+
else
113+
install -m 755 goreleaser /usr/local/bin/goreleaser
114+
fi
115+
rm -f "${FILE}" goreleaser
116+
- name: Create release (DRAFT)
83117
env:
84118
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for creating GH release
85119
GORELEASER_CURRENT_TAG: ${{ github.ref_name }} # specify the tag to be released
86120
id: goreleaser
87-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6
88-
with:
89-
distribution: goreleaser
90-
version: "~> v2"
91-
args: release --clean --verbose
121+
shell: bash
122+
run: |-
123+
goreleaser release --clean --verbose --draft
124+
if [[ ! -f dist/metadata.json ]] || [[ ! -s dist/metadata.json ]]; then
125+
echo "Missing required file: dist/metadata.json"
126+
exit 1
127+
fi
128+
if [[ ! -f dist/artifacts.json ]] || [[ ! -s dist/artifacts.json ]]; then
129+
echo "Missing required file: dist/artifacts.json"
130+
exit 1
131+
fi
132+
echo "metadata=$(tr -d '\n\r' < dist/metadata.json)" >> "${GITHUB_OUTPUT}"
133+
echo "artifacts=$(tr -d '\n\r' < dist/artifacts.json)" >> "${GITHUB_OUTPUT}"
92134
- name: Upload charts to release
93135
env:
94136
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required for updating GH release
@@ -106,7 +148,6 @@ jobs:
106148
gh release upload $TAG $f
107149
done
108150
echo "Charts successfully uploaded to GitHub release $TAG"
109-
110151
- name: Add charts to branch
111152
env:
112153
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -138,8 +179,13 @@ jobs:
138179
git add charts/**/*
139180
git commit -m "Update charts to version $version"
140181
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
141-
git push origin "$charts_branch"
142-
182+
git push origin "$charts_branch"
183+
- name: Publish GitHub release
184+
env:
185+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
186+
run: |
187+
gh release edit "${{ github.ref_name }}" --draft=false
188+
143189
dispatch-chart-release:
144190
permissions:
145191
contents: read

0 commit comments

Comments
 (0)