-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (114 loc) · 2.9 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
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
name: Build and Release
on:
push:
branches: [main]
tags:
- "v*.*.*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Test
run: make test
- name: Code Coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.html
build_cli:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: build
strategy:
matrix:
os:
- 'darwin'
- 'linux'
arch:
- 'amd64'
- 'arm64'
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Build CLI
run: GOOS=${{matrix.os}} GOARCH=${{matrix.arch}} go build -o "./bin/fabled-story-book-${{matrix.os}}-${{matrix.arch}}" ./cmd/cli/main.go
- name: Artifact Upload
uses: actions/upload-artifact@v4
with:
name: fabled-story-book-${{matrix.os}}-${{matrix.arch}}
path: bin/*
build_web:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: acifani/setup-tinygo@v2
with:
tinygo-version: '0.30.0'
- name: Build WASM
run: make wasm
- name: Artifact Upload
uses: actions/upload-artifact@v4
with:
name: wasm
path: web/src/jabl.wasm
publish_web:
runs-on: ubuntu-latest
needs: build_web
permissions:
contents: read
deployments: write
steps:
- uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: wasm
path: web/src
- name: Install Web Dependencies
run: npm ci
working-directory: ./web
- name: Build Web
run: |
npm run build
npm run build:css
working-directory: ./web
- name: Publish Web
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 95ffb963e9a7dc68ae10699ffec445b2
projectName: fabled-story-book
directory: ./dist
workingDirectory: ./web
wranglerVersion: '3'
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
publish_release:
runs-on: ubuntu-latest
needs: [build_cli, publish_web]
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Publish Release
uses: softprops/action-gh-release@v1
with:
files: |
./dist/*
generate_release_notes: true
name: Fabled Story Book ${{ github.ref_name }}
target_commitish: ${{ github.sha }}