A tool for archiving & converting scans of postcards, and information about them.
1name: Bump version & release
2
3on:
4 push:
5 branches:
6 - main
7
8permissions:
9 contents: write
10
11jobs:
12 bump-version:
13 if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
14 runs-on: ubuntu-latest
15 name: "Bump version and create changelog with commitizen"
16 outputs:
17 new_version: ${{ steps.new_version.outputs.version }}
18 steps:
19 - name: Check out
20 uses: actions/checkout@v4
21 with:
22 fetch-depth: 0
23 - name: Create bump and changelog
24 uses: commitizen-tools/commitizen-action@master
25 with:
26 github_token: ${{ secrets.GH_TOKEN }}
27 - name: Extract new version
28 if: success()
29 id: new_version
30 run: |
31 VERSION=$(git describe --tags --exact-match 2> /dev/null || true)
32 [[ ! -z $VERSION ]] && echo "version=${VERSION}" >> $GITHUB_OUTPUT || true
33 goreleaser:
34 needs: bump-version
35 if: "${{ needs.bump-version.outputs.new_version != '' }}"
36 runs-on: ubuntu-latest
37 name: Release binaries as Github releases
38 steps:
39 - uses: actions/checkout@v4
40 with:
41 ref: ${{ needs.bump-version.outputs.new_version }}
42 fetch-depth: 0
43 - run: git fetch --force --tags
44 - uses: actions/setup-go@v5
45 with:
46 go-version-file: go.mod
47 - uses: acifani/setup-tinygo@v2
48 with:
49 tinygo-version: "0.38.0"
50 - name: Build postoffice-serviceworker
51 uses: goreleaser/goreleaser-action@v6
52 with:
53 version: "~> v2"
54 args: build --clean --id=postoffice-serviceworker
55 env:
56 GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
57 - name: Move Serviceworker WASM ready for postoffice build
58 run: |
59 mv dist/postoffice-serviceworker_js_wasm/postoffice-serviceworker.wasm internal/www/postoffice/postoffice-serviceworker.wasm
60 - name: Run GoReleaser
61 uses: goreleaser/goreleaser-action@v6
62 with:
63 version: "~> v2"
64 args: release --clean
65 env:
66 GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
67 - name: Upload static Postoffice site artifact
68 uses: actions/upload-pages-artifact@v3
69 with:
70 name: postoffice-static
71 path: internal/www/postoffice
72
73 deploy-postoffice-static:
74 name: Deploy Postoffice to Github Pages
75 needs: goreleaser
76 runs-on: ubuntu-latest
77 permissions:
78 pages: write
79 id-token: write
80 environment:
81 name: Postoffice Web
82 url: ${{ steps.deployment.outputs.page_url }}
83 steps:
84 - name: Deploy to GitHub Pages
85 id: deployment
86 uses: actions/deploy-pages@v4
87 with:
88 artifact_name: postoffice-static