Skip to content

Commit

Permalink
feat(CI): create NewCI for embedding static files into Go binaries (#583
Browse files Browse the repository at this point in the history
)

Co-authored-by: bzp2010 <baizp@iydhp.com>
  • Loading branch information
bzp2010 and bzp2010 authored Oct 22, 2020
1 parent e9d5040 commit 097b5ff
Showing 1 changed file with 71 additions and 0 deletions.
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

0 comments on commit 097b5ff

Please sign in to comment.