Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(CI): NewCI for embedding static files into Go binaries #583

Merged
merged 1 commit into from
Oct 22, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/api_newci.yml
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