-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CI): create NewCI for embedding static files into Go binaries (#583
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: NewCI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
frontend: | ||
name: Front-End compile | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Node.JS environment for Front-End | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
|
||
- name: Install Front-End dependencies | ||
run: yarn install | ||
|
||
- name: Build Front-End | ||
run: yarn build | ||
|
||
- name: Store Compiled Front-End files | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: dist | ||
path: ./dist/ | ||
|
||
backend: | ||
name: Back-End compile | ||
needs: frontend | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Copy file to Back-End compile environment | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: dist | ||
path: ./api/dashboard/ | ||
|
||
- name: Setup Golang environment for Back-End | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14 | ||
|
||
- name: Setup Build Environment | ||
run: | | ||
cd ./api/ | ||
sudo go get github.com/rakyll/statik | ||
- name: Generate Built-in Code | ||
run: | | ||
cd ./api/ | ||
$(go env GOPATH)/bin/statik -src=./dashboard/ | ||
- name: Build Back-End Binary | ||
run: | | ||
cd ./api/ | ||
sudo go build -o /go/manager-api/manager-api | ||
- name: Store Compiled Back-End files | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: output | ||
path: /go/manager-api/manager-api |