-
Notifications
You must be signed in to change notification settings - Fork 7
83 lines (66 loc) · 2.4 KB
/
go.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
name: Build and Deploy sprintnamegenerator.com
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
IMAGE_NAME: ${{ secrets.DOCKER_HUB_USERNAME }}/sprint-name-generator
# See https://github.com/Azure/container-scan/issues/146
DOCKLE_HOST: "unix:///var/run/docker.sock"
steps:
- name: Set up Go 1.18
uses: actions/setup-go@v1
with:
go-version: 1.18
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build api
run: go build -v -o main ${{ github.workspace }}/cmd/name-generator
- name: Build wasm
run: GOOS=js GOARCH=wasm go build -o web/generator.wasm ${{ github.workspace }}/cmd/web
- name: Copy wasm_exec
run: cp $GOROOT/misc/wasm/wasm_exec.js ${{ github.workspace }}/web/wasm_exec.js
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- run: npm install
working-directory: ${{ github.workspace }}/web
- run: npm run build --if-present
working-directory: ${{ github.workspace }}/web
env:
CI: true
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build Docker image
run: docker build . -f ${{ github.workspace }}/build/package/Dockerfile -t ${{ env.IMAGE_NAME }}:${{github.run_number}} -t ${{ env.IMAGE_NAME }}:latest
- name: Run container image security scan
uses: Azure/[email protected]
with:
image-name: ${{ env.IMAGE_NAME }}:${{github.run_number}}
severity-threshold: CRITICAL
run-quality-checks: true
- name: Push versioned Docker image
run: docker push ${{ env.IMAGE_NAME }}:${{github.run_number}}
- name: Push latest Docker versioned image
run: docker push ${{ env.IMAGE_NAME }}:latest
- name: Deploy Page
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages
folder: ${{ github.workspace }}/web/build