This repository has been archived by the owner on Jul 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (79 loc) · 2.77 KB
/
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
89
90
91
92
93
#
# Automatically tag a merge with master, or build a new image from the tag.
#
# Secrets required:
# * `GOOGLE_APPLICATION_CREDENTIALS` - for goreleaser blob publish
#
name: Release
on:
push:
branches:
- main
jobs:
tag-build-publish:
name: Tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: "0" # make sure we get all commits!
- name: Authorize Google Account
id: "auth"
uses: "google-github-actions/auth@v0"
with:
credentials_json: "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}"
- name: Bump version and push tag
id: bump
uses: anothrNick/github-tag-action@1.36.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCHES: main
WITH_V: true
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21
# Ensure we have a wasm_exec.js for the current version of Go
- name: Copy Go WASM Exec
if: ${{ steps.bump.new_tag == steps.bump.tag }}
run: cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./gobl-worker/src
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
# Following actions are to release a new version of gobl-worker to NPM
# using the new wasm version in the CDN.
- name: Install Node.js
uses: actions/setup-node@v3
if: ${{ steps.bump.new_tag == steps.bump.tag }}
with:
node-version: 16.x
cache: "npm"
cache-dependency-path: "./gobl-worker/package-lock.json"
- name: Run npm install
if: ${{ steps.bump.new_tag == steps.bump.tag }}
working-directory: ./gobl-worker
run: npm install
- name: Update gobl-worker version
if: ${{ steps.bump.new_tag == steps.bump.tag }}
working-directory: ./gobl-worker
run: npm version --no-git-tag-version ${{ steps.bump.outputs.new_tag }}
- name: Build gobl-worker
if: ${{ steps.bump.new_tag == steps.bump.tag }}
working-directory: ./gobl-worker
run: npm run build
- name: Publish gobl-worker to NPM registry
if: ${{ steps.bump.new_tag == steps.bump.tag }}
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./gobl-worker/package.json
access: public