-
-
Notifications
You must be signed in to change notification settings - Fork 36
149 lines (144 loc) · 4.14 KB
/
releases-cd.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
139
140
141
142
143
144
145
146
147
148
149
name: Releases CD
on:
workflow_dispatch:
push:
tags:
- '*'
jobs:
frontend:
name: Build Frontend Artifacts
runs-on: ubuntu-latest
steps:
- name: Set up NodeJS
uses: actions/setup-node@v1
with:
node-version: '18.x'
- name: Check out code
uses: actions/checkout@v2
- name: Install dependencies
working-directory: ./web
run: yarn
- name: Build Web App
working-directory: ./web
run: yarn run build --base=/
- name: Upload Artifcats
uses: actions/upload-artifact@v2
with:
name: frontend
path: web/dist/web
retention-days: 1
backend:
name: Build Backend Artifacts
runs-on: ubuntu-latest
needs:
- frontend
strategy:
matrix:
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '^1.21'
- name: Check out code
uses: actions/checkout@v2
- name: Retrieve frontend files
uses: actions/download-artifact@v2
with:
name: frontend
path: internal/util/embedded/webdist
- name: Get dependencies
run: go get -v ./...
- name: Populate info embeds
run: bash ./ci/populateinfo.sh
- name: Build Backend (${{ matrix.goos }}-${{ matrix.goarch }})
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: go build -o ./bin/shinpuru-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/shinpuru/main.go
- name: Rename Windows Binary
if: ${{ matrix.goos == 'windows' }}
env:
FNAME: ./bin/shinpuru-${{ matrix.goos }}-${{ matrix.goarch }}
run: mv ${{ env.FNAME }} ${{ env.FNAME }}.exe
- name: Upload Artifcats
uses: actions/upload-artifact@v2
with:
name: backend
path: bin/
retention-days: 1
setup:
name: Build Setup CLI Artifacts
runs-on: ubuntu-latest
strategy:
matrix:
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
steps:
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '^1.21'
- name: Check out code
uses: actions/checkout@v2
- name: Get dependencies
run: go get -v ./...
- name: Build CLI (${{ matrix.goos }}-${{ matrix.goarch }})
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: go build -o ./bin/setup-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/setup/main.go
- name: Rename Windows Binary
if: ${{ matrix.goos == 'windows' }}
env:
FNAME: ./bin/setup-${{ matrix.goos }}-${{ matrix.goarch }}
run: mv ${{ env.FNAME }} ${{ env.FNAME }}.exe
- name: Upload Artifcats
uses: actions/upload-artifact@v2
with:
name: setup
path: bin/
retention-days: 1
deploy:
name: Deploy to Releases
runs-on: ubuntu-latest
needs:
- 'setup'
- 'backend'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Retrieve backend binaries
uses: actions/download-artifact@v2
with:
name: backend
path: bin/
- name: Retrieve setup binaries
uses: actions/download-artifact@v2
with:
name: setup
path: bin/
- name: Inject Version into Changelog
run: |-
sed -i "s/\[VERSION\]/$(git describe --tags --abbrev=0)/g" CHANGELOG.md
- name: Set up Hub
run: |-
sudo snap install hub --classic
- name: Deploy to Releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: "hub release create
$(ls ./bin -1 | xargs -I % printf '-a ./bin/% ')
-F ./CHANGELOG.md
$(git describe --tags --abbrev=0)"