You can now print numbers and dice rolls #43
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
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: GOOS=js GOARCH=wasm tinygo build -o ./web/test.wasm -target wasm -no-debug ./cmd/wasm/main.go | |
- name: Artifact Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wasm | |
path: web/test.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 | |
- name: Publish Web | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: 95ffb963e9a7dc68ae10699ffec445b2 | |
projectName: fabled-story-book | |
directory: ./web | |
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 }} |