feat: keep users on their page across login and locale switch #12
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [master] | |
| tags: ["v*"] | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| binaries: | |
| # Tag pushes are handled by the release workflow, which attaches the | |
| # same binaries to the GitHub Release. | |
| if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { goos: linux, goarch: amd64 } | |
| - { goos: linux, goarch: "386" } | |
| - { goos: linux, goarch: arm64 } | |
| - { goos: linux, goarch: arm, goarm: "7" } | |
| - { goos: linux, goarch: ppc64le } | |
| - { goos: linux, goarch: riscv64 } | |
| - { goos: linux, goarch: s390x } | |
| - { goos: linux, goarch: loong64 } | |
| - { goos: darwin, goarch: amd64 } | |
| - { goos: darwin, goarch: arm64 } | |
| - { goos: windows, goarch: amd64 } | |
| - { goos: windows, goarch: "386" } | |
| - { goos: windows, goarch: arm64 } | |
| - { goos: freebsd, goarch: amd64 } | |
| - { goos: freebsd, goarch: arm64 } | |
| - { goos: openbsd, goarch: amd64 } | |
| - { goos: openbsd, goarch: arm64 } | |
| - { goos: netbsd, goarch: amd64 } | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Set up Go | |
| uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| # Runs natively: GOOS/GOARCH are scoped to the build step below so | |
| # templ (a Go tool) is built and executed for the runner, not the target. | |
| - name: Generate templ code | |
| run: go tool templ generate | |
| - name: Build | |
| env: | |
| CGO_ENABLED: 0 | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| GOARM: ${{ matrix.goarm }} | |
| run: | | |
| ext="" | |
| [ "$GOOS" = "windows" ] && ext=".exe" | |
| name="time-tracker_${GOOS}_${GOARCH}" | |
| mkdir -p "dist/${name}" | |
| go build -trimpath -ldflags "-s -w" -o "dist/${name}/time-tracker${ext}" ./cmd/time-tracker | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: time-tracker_${{ matrix.goos }}_${{ matrix.goarch }} | |
| path: dist/time-tracker_${{ matrix.goos }}_${{ matrix.goarch }} | |
| if-no-files-found: error | |
| docker: | |
| # No registry push for pull requests (no access to secrets anyway). | |
| if: ${{ github.event_name != 'pull_request' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| # No QEMU needed: the Dockerfile cross-compiles from the native builder. | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=semver,pattern={{version}} | |
| type=sha | |
| - name: Build and push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6,linux/386,linux/ppc64le,linux/s390x,linux/riscv64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |