-
Notifications
You must be signed in to change notification settings - Fork 17
88 lines (77 loc) · 2.35 KB
/
perform-release.yaml
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
name: Create a release on VERSION update
on:
push:
branches:
- main
paths:
- VERSION
jobs:
test:
name: Run all tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: 1.16
- uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Perform tests
run: go test ./...
create-release-tag:
name: Create release tag
runs-on: ubuntu-latest
needs:
- test
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create tag
uses: actions/github-script@v3
with:
github-token: ${{ github.token }}
script: |
const fs = require('fs');
const version = fs.readFileSync('VERSION', 'utf8').trim();
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/v${version}`,
sha: context.sha
})
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- uses: actions/setup-node@v2
with:
node-version: 'lts/*'
cache: 'npm'
cache-dependency-path: "gui/package-lock.json"
- run: npm i -g npm@latest
- run: npm ci
working-directory: ./gui
- name: Get version from VERSION file
id: get_version
run: echo ::set-output name=release_version::$(cat VERSION | tr -d '[:space:]')
- run: git tag ${{ steps.get_version.outputs.release_version }}
- name: Run GoReleaser
run: make release
env:
# Need a custom personal access token to allow publishing to
# the deref/homebrew-tap repository.
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
- name: Update version in CloudFlare K/V
uses: cloudflare/wrangler-action@1.3.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
publish: false
preCommands: wrangler kv:key put --binding VERSIONS "exo" ${{ steps.get_version.outputs.release_version }}