only process the .md files #306
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: Build | |
run: CGO_ENABLED=0 GOARCH=arm64 go build -o blog -v -ldflags="-s -w" 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 }} |