name: Bump version & release on: push: branches: - main permissions: contents: write jobs: bump-version: if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }} runs-on: ubuntu-latest name: "Bump version and create changelog with commitizen" outputs: new_version: ${{ steps.new_version.outputs.version }} steps: - name: Check out uses: actions/checkout@v4 with: fetch-depth: 0 - name: Create bump and changelog uses: commitizen-tools/commitizen-action@master with: github_token: ${{ secrets.GH_TOKEN }} - name: Extract new version if: success() id: new_version run: | VERSION=$(git describe --tags --exact-match 2> /dev/null || true) [[ ! -z $VERSION ]] && echo "version=${VERSION}" >> $GITHUB_OUTPUT || true goreleaser: needs: bump-version if: "${{ needs.bump-version.outputs.new_version != '' }}" runs-on: ubuntu-latest name: Release binaries as Github releases steps: - uses: actions/checkout@v4 with: ref: ${{ needs.bump-version.outputs.new_version }} fetch-depth: 0 - run: git fetch --force --tags - uses: actions/setup-go@v5 with: go-version-file: go.mod - uses: acifani/setup-tinygo@v2 with: tinygo-version: "0.38.0" - name: Build postoffice-serviceworker uses: goreleaser/goreleaser-action@v6 with: version: "~> v2" args: build --clean --id=postoffice-serviceworker env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - name: Move Serviceworker WASM ready for postoffice build run: | mv dist/postoffice-serviceworker_js_wasm/postoffice-serviceworker.wasm internal/www/postoffice/postoffice-serviceworker.wasm - name: Run GoReleaser uses: goreleaser/goreleaser-action@v6 with: version: "~> v2" args: release --clean env: GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - name: Upload static Postoffice site artifact uses: actions/upload-pages-artifact@v3 with: name: postoffice-static path: internal/www/postoffice deploy-postoffice-static: name: Deploy Postoffice to Github Pages needs: goreleaser runs-on: ubuntu-latest permissions: pages: write id-token: write environment: name: Postoffice Web url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 with: artifact_name: postoffice-static