-
Notifications
You must be signed in to change notification settings - Fork 9
138 lines (127 loc) · 3.8 KB
/
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
134
135
136
137
138
name: release
on:
push:
tags:
- "v*"
jobs:
build-mac:
runs-on: macos-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release -f .goreleaser/mac.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
build-linux:
runs-on: ubuntu-latest
env:
# https://goreleaser.com/customization/docker_manifest/
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Docker Login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release -f .goreleaser/linux.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
build-windows:
runs-on: windows-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release -f .goreleaser/windows.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
build-windows-npm:
runs-on: windows-latest
steps:
- name: Code checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.18.1
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: release -f .goreleaser/windows-npm.yml --clean
env:
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
publish-npm:
runs-on: ubuntu-latest
needs: [build-windows-npm, build-linux, build-mac]
steps:
- uses: actions/checkout@v4
with:
# Checkout on main so that the later commit works
ref: main
# With permission to push to a protected branch
token: ${{ secrets.READ_WRITE_PAT }}
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
- name: Get GitHub tag version
# Store the version, stripping any v-prefix
id: tag-version
run: |
TAG_VERSION=${GITHUB_REF_NAME#v}
echo Version: $TAG_VERSION
echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_OUTPUT
- name: Update package.json version
uses: jossef/[email protected]
with:
file: package.json
field: version
value: ${{ steps.tag-version.outputs.TAG_VERSION }}
- name: Commit package.json version
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Update package.json version to ${{ steps.tag-version.outputs.TAG_VERSION }}'
add: 'package.json'
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}