-
Notifications
You must be signed in to change notification settings - Fork 208
133 lines (127 loc) · 4.25 KB
/
cli-release.yml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: cli-release
# Releases the Devbox CLI
concurrency: cli-release
on:
# Build/Release on demand
workflow_dispatch:
inputs:
create_edge_release:
description: "Create edge release?"
required: false
default: false
type: boolean
schedule:
- cron: "45 8 * * 4" # Create edge weekly on Thursdays.
push:
tags:
- "*" # Tags that trigger a new release version
permissions:
contents: write
pull-requests: read
id-token: write # Needed for aws-actions/configure-aws-credentials@v1
jobs:
tests:
uses: ./.github/workflows/cli-tests.yaml
with:
# This will run the basic testscript unit tests on MacOS.
# NOTE: cli-tests will NEVER run project-tests on MacOS.
run-mac-tests: true
edge:
runs-on: ubuntu-latest
environment: release
needs: tests
if: ${{ inputs.create_edge_release || github.event.schedule }}
steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed by goreleaser to browse history.
- name: Determine edge tag
# This tag is semver and works with semver.Compare
run: echo "EDGE_TAG=0.0.0-edge.$(date +%Y-%m-%d)" >> $GITHUB_ENV
- name: Set edge tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ env.EDGE_TAG }}
tag_prefix: ""
- name: Set up go
uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
- name: Build snapshot with goreleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist --skip-publish --skip-announce --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TELEMETRY_KEY: ${{ secrets.TELEMETRY_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
environment: development
version: ${{ env.EDGE_TAG }}
- name: Publish snapshot release to GitHub
uses: softprops/action-gh-release@v1
with:
prerelease: true
body: "${{ env.EDGE_TAG }} edge release"
fail_on_unmatched_files: true
tag_name: ${{ env.EDGE_TAG }}
files: |
dist/checksums.txt
dist/*.tar.gz
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_ROLE }}
aws-region: us-west-2
- name: Update edge version in s3
run: |
tmp_file=$(mktemp)
echo "${{ env.EDGE_TAG }}" > $tmp_file
aws s3 cp $tmp_file s3://releases.jetpack.io/devbox/edge/version
release:
runs-on: ubuntu-latest
environment: release
needs: tests
# Only release when there's a tag for the release.
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout source code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed by goreleaser to browse history.
- name: Set up go
uses: actions/setup-go@v4
with:
go-version-file: ./go.mod
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }}
with:
environment: production
version: ${{ github.ref }}
- name: Release with goreleaser
uses: goreleaser/goreleaser-action@v3
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
DISCORD_WEBHOOK_ID: ${{ secrets.DISCORD_WEBHOOK_ID }}
DISCORD_WEBHOOK_TOKEN: ${{ secrets.DISCORD_WEBHOOK_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TELEMETRY_KEY: ${{ secrets.TELEMETRY_KEY }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}