Skip to content

Commit 0308a33

Browse files
authored
Fix release workflow (#618)
- Ignore build for Windows ARM64 - Install proper UPX version - Make sure the GCP credentials cannot be committed and pushed from the pipeline - Increase timeout for Goreleaser
1 parent c28f0be commit 0308a33

File tree

4 files changed

+43
-13
lines changed

4 files changed

+43
-13
lines changed

.github/workflows/make-release.yaml

+32-8
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,49 @@ jobs:
4646
go-version: ${{env.GO_VERSION}}
4747
- name: Set up GoReleaser
4848
run: go install github.com/goreleaser/[email protected]
49-
- name: Set up GCS
50-
uses: google-github-actions/setup-gcloud@master
51-
with:
52-
service_account_key: ${{ secrets.GCS_CREDS }}
53-
export_default_credentials: true
54-
- name: Log into registry
55-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
5649
- name: Push release commits and tag
5750
env:
5851
RELEASE_VERSION: "${{ github.event.inputs.version }}"
5952
DASHBOARD_IMAGE_TAG: "${{ github.event.inputs.dashboard_image_tag }}"
6053
run: ./hack/make-release.sh
54+
- name: Log into registry
55+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
56+
- name: Install upx 3.96
57+
run: |
58+
wget https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz
59+
tar -xf upx-3.96-amd64_linux.tar.xz
60+
mv ./upx-3.96-amd64_linux/upx /usr/local/bin/upx
61+
upx -V
62+
- id: auth
63+
name: Authenticate with Google Cloud platform
64+
uses: google-github-actions/[email protected]
65+
with:
66+
create_credentials_file: true
67+
cleanup_credentials: true
68+
credentials_json: ${{ secrets.GCS_CREDS }}
69+
- name: Ignore credentials
70+
env:
71+
GCP_CREDS_FILEPATH: ${{ steps.auth.outputs.credentials_file_path }}
72+
run: |
73+
echo "Preventing pushing to the origin..."
74+
git remote set-url --push origin no_push
75+
76+
GCP_CREDS_FILENAME=$(basename $GCP_CREDS_FILEPATH)
77+
echo "Adding ${GCP_CREDS_FILENAME} to local .gitignore..."
78+
echo "${GCP_CREDS_FILENAME}" >> .gitignore
79+
80+
echo "Committing the change..."
81+
git add .gitignore
82+
git commit -m "Ignore credentials"
83+
- name: Set up Cloud SDK
84+
uses: google-github-actions/[email protected]
6185
- name: Run GoReleaser
6286
env:
6387
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6488
run: make release-binaries
6589
- name: Generate release notes
6690
run: |
67-
npm install -g github-release-notes
91+
npm install -g github-release-notes@~0.17.3
6892
gren release -d -T "${{ secrets.GITHUB_TOKEN }}" --tags "v${{ github.event.inputs.version }}" --override
6993
- name: Release Helm charts
7094
run: make release-charts

.gitignore

-4
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ coverage.txt
5353
# Backup files
5454
*.bak
5555

56-
# UUID file created by `setup-gcloud` GitHub Action when `export_default_credentials` is enabled
57-
# Read more at https://github.com/GoogleCloudPlatform/github-actions/tree/master/setup-gcloud
58-
/[a-f,0-9]*-[a-f,0-9]*-[a-f,0-9]*-[a-f,0-9]*-[a-f,0-9]*
59-
6056
# Vim
6157
*.swp
6258
*.swo

.goreleaser.yml

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ builds:
2323
- "386"
2424
- amd64
2525
- arm64
26+
ignore: &build-ignore
27+
# upx doesn't support packing Windows Arm64 binaries - see https://github.com/upx/upx/issues/551
28+
# once there is more demand from the community to build such binary, we will create a separate build config for this combination
29+
- goos: windows
30+
goarch: arm64
2631
hooks: &build-hooks
2732
# Install upx first, https://github.com/upx/upx/releases
2833
post: upx -9 "{{ .Path }}"
@@ -37,6 +42,7 @@ builds:
3742
env: *build-env
3843
goos: *build-goos
3944
goarch: *build-arch
45+
ignore: *build-ignore
4046
hooks: *build-hooks
4147
main: ./cmd/populator
4248
binary: 'populator-{{ .Os }}-{{ .Arch }}'

Makefile

+5-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ release-charts: ## Release Capact Helm Charts
204204
.PHONY: release-charts
205205

206206
release-binaries: ## Release stable Capact binaries, such as CLI, populator etc.
207-
goreleaser release --rm-dist
207+
# --skip-validate is needed as we need to locally ignore GCP credentials
208+
# by creating a commit, which is not pushed to the origin.
209+
# That makes the goreleaser's validation fail with error "it tag {tag} was not made against commit {commit hash}"
210+
# Even if we not create such commit, goreleaser would fail because of git dirty state.
211+
goreleaser release --skip-validate --rm-dist --timeout 60m
208212

209213
release-latest-binaries: ## Release latest Capact binaries
210214
goreleaser release --snapshot --rm-dist --config .goreleaser.latest.yml

0 commit comments

Comments
 (0)