-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (74 loc) · 2.33 KB
/
ci.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: Squish CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ created ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
release:
name: Release
needs: test
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
- name: Build
run: |
GOOS=linux GOARCH=amd64 go build -o squish-linux-amd64
GOOS=darwin GOARCH=amd64 go build -o squish-darwin-amd64
GOOS=windows GOARCH=amd64 go build -o squish-windows-amd64.exe
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./squish-linux-amd64
asset_name: squish-linux-amd64
asset_content_type: application/octet-stream
- name: Upload Release Assets (MacOS)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./squish-darwin-amd64
asset_name: squish-darwin-amd64
asset_content_type: application/octet-stream
- name: Upload Release Assets (Windows)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./squish-windows-amd64.exe
asset_name: squish-windows-amd64.exe
asset_content_type: application/octet-stream
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Publish to npm
run: pnpm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}