Skip to content

Commit 6dbd108

Browse files
authored
[CICD] Fix pre-release job and create new edge release process. (#985)
## Summary This needed some changes for it to work again. Changes: * Renamed to alpha * Create a new tag of the form `ALPHA_TAG=0.0.0-alpha.$(date +%Y-%m-%d)` This tag is semver. * Run goreleaser --snapshot with this tag as version. * Create/update github release with same name as tag. This almost works with new CLI launcher. It has a regex that is not completely accurate so it complains that a version ending in `.2023-01-1` is not valid. ## How was it tested? Github actions
1 parent 63a4483 commit 6dbd108

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

.github/workflows/cli-release.yml

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ on:
77
# Build/Release on demand
88
workflow_dispatch:
99
inputs:
10-
is_prerelease:
11-
description: "Pre-release?"
10+
create_edge_release:
11+
description: "Create edge release?"
1212
required: false
1313
default: false
1414
type: boolean
1515
schedule:
16-
- cron: "45 8 * * 4" # Weekly pre-release on Thursdays.
16+
- cron: "45 8 * * 4" # Create edge weekly on Thursdays.
1717
push:
1818
tags:
1919
- "*" # Tags that trigger a new release version
@@ -23,23 +23,32 @@ permissions:
2323
pull-requests: read
2424
id-token: write # Needed for aws-actions/configure-aws-credentials@v1
2525

26-
2726
jobs:
2827
tests:
2928
uses: ./.github/workflows/cli-tests.yaml
3029
with:
3130
run-mac-tests: true
3231

33-
prerelease:
32+
edge:
3433
runs-on: ubuntu-latest
3534
environment: release
3635
needs: tests
37-
if: ${{ inputs.is_prerelease || github.event.schedule }}
36+
if: ${{ inputs.create_edge_release || github.event.schedule }}
3837
steps:
3938
- name: Checkout source code
4039
uses: actions/checkout@v3
4140
with:
4241
fetch-depth: 0 # Needed by goreleaser to browse history.
42+
- name: Determine edge tag
43+
# This tag is semver and works with semver.Compare
44+
run: echo "EDGE_TAG=0.0.0-edge.$(date +%Y-%m-%d)" >> $GITHUB_ENV
45+
- name: Set edge tag
46+
id: tag_version
47+
uses: mathieudutour/[email protected]
48+
with:
49+
github_token: ${{ secrets.GITHUB_TOKEN }}
50+
custom_tag: ${{ env.EDGE_TAG }}
51+
tag_prefix: ""
4352
- name: Set up go
4453
uses: actions/setup-go@v4
4554
with:
@@ -55,28 +64,39 @@ jobs:
5564
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5665
TELEMETRY_KEY: ${{ secrets.TELEMETRY_KEY }}
5766
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
58-
- name: Determine snapshot tag
59-
run: |
60-
TAG=$(ls dist/*_linux_386.tar.gz | cut -d '_' -f 2 | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+-dev')
61-
echo "release_tag=$TAG" >> $GITHUB_ENV
6267
- name: Create Sentry release
6368
uses: getsentry/action-release@v1
6469
env:
6570
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
66-
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
67-
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
71+
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
72+
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
6873
with:
6974
environment: development
70-
version: ${{ env.release_tag }}
75+
version: ${{ env.EDGE_TAG }}
76+
- name: Create release body
77+
run: echo "BODY=$(git log --pretty=oneline $(git describe --tags --abbrev=0 --match '0.0.0-edge*')..HEAD)" >> $GITHUB_OUTPUT
78+
id: body
7179
- name: Publish snapshot release to GitHub
7280
uses: softprops/action-gh-release@v1
7381
with:
7482
prerelease: true
83+
body: ${{ steps.body.outputs.BODY }}
7584
fail_on_unmatched_files: true
76-
tag_name: ${{ env.release_tag }}
85+
tag_name: ${{ env.EDGE_TAG }}
7786
files: |
7887
dist/checksums.txt
7988
dist/*.tar.gz
89+
- name: Configure AWS Credentials
90+
uses: aws-actions/configure-aws-credentials@v1
91+
with:
92+
role-to-assume: ${{ secrets.AWS_ROLE }}
93+
aws-region: us-west-2
94+
- name: Update edge version in s3
95+
run: |
96+
tmp_file=$(mktemp)
97+
echo "${{ env.EDGE_TAG }}" > $tmp_file
98+
aws s3 cp $tmp_file s3://releases.jetpack.io/devbox/edge/version
99+
80100
release:
81101
runs-on: ubuntu-latest
82102
environment: release

.goreleaser.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ archives:
2626
- no-files-will-match-* # Glob that does not match to create archive with only binaries.
2727
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
2828
snapshot:
29-
name_template: "{{ incpatch .Version }}-dev"
29+
name_template: "{{ .Env.EDGE_TAG }}"
3030
checksum:
3131
name_template: "checksums.txt"
3232
algorithm: sha256

0 commit comments

Comments
 (0)