-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (98 loc) · 2.91 KB
/
publish-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
name: Build and deploy
run-name: Build and deploy ${{github.ref_name}}
on:
workflow_dispatch:
release:
types: [created]
jobs:
sanity-checks:
name: Prerelease sanity checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Ensure kibble-npm package version matches the tag
env:
WORKFLOW_REF: ${{github.ref_name}}
run: |
cd kibble-npm
NPM_PACKAGE_VERSION=`node -p 'require("./package.json").version'`
if [ "$NPM_PACKAGE_VERSION" != "$WORKFLOW_REF" ]; then
echo "::error file=kibble-npm/package.json,title=NPM package version mismatch::Cannot publish as the package version is $NPM_PACKAGE_VERSION but the workflow tag is $WORKFLOW_REF"
exit 1
fi
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.48.0
working-directory: ./kibble
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Run tests
working-directory: ./kibble
run: make test
release:
name: Release
needs: [sanity-checks, lint, test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.18
- name: Install GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: v1.10.3
install-only: true
- run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ vars.KIBBLE_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.KIBBLE_DEPLOY_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ap-southeast-2
publish-npm:
name: Publish to NPM
needs: [release]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: "https://registry.npmjs.org"
- name: Install deps
working-directory: kibble-npm
run: npm ci
- name: Publish wrapper package to npm
working-directory: kibble-npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}