server-side tracking: add /stats #321
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: Go | |
on: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- 'README.md' | |
pull_request: | |
jobs: | |
build: | |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.54 | |
- name: Test | |
run: go test -v ./... | |
- name: Install AArch64 target toolchain | |
run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu libc6-dev-arm64-cross | |
- name: Build | |
run: CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CGO_ENABLED=1 GOARCH=arm64 go build -o blog -v -ldflags="-s -w -linkmode 'external' -extldflags '-static'" cmd/blog/main.go | |
- name: Set up QEMU | |
if: github.event_name == 'push' | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
if: github.event_name == 'push' | |
uses: docker/setup-buildx-action@v1 | |
- name: Log into GitHub Container Registry | |
if: github.event_name == 'push' | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Get branch name (merge) | |
if: github.event_name != 'pull_request' | |
shell: bash | |
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
- name: Push to Github Container Registry | |
if: github.event_name == 'push' | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm/v8 | |
push: true | |
tags: ghcr.io/${{ github.repository }}:${{ env.BRANCH_NAME }} |