Skip to content

Commit f4a852a

Browse files
committed
Initial work on Github Actions workflow
1 parent 6c624b6 commit f4a852a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/workflow.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI (main and tags)
2+
on:
3+
push:
4+
branches: [ "main", "gh-actions" ]
5+
tags: [ "v*" ]
6+
permissions:
7+
checks: write
8+
contents: write
9+
packages: write
10+
pull-requests: read
11+
jobs:
12+
lint-test:
13+
name: Lint
14+
runs-on: ubuntu-latest
15+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-go@v5
19+
- name: lint
20+
uses: golangci/golangci-lint-action@v6
21+
with:
22+
version: latest
23+
24+
build-publish:
25+
name: Build and Publish
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v1
30+
- name: Login to ghcr.io
31+
uses: docker/login-action@v3
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
- name: Extract metadata (tags, labels) for Docker
37+
id: meta
38+
uses: docker/metadata-action@v5
39+
with:
40+
images: |
41+
ghcr.io/${{ github.repository }}
42+
tags: |
43+
type=raw,value=latest,enable=${{ github.ref_name == 'gh-actions' }}
44+
type=semver,pattern={{raw}}
45+
- name: Build and push
46+
uses: docker/build-push-action@v6
47+
with:
48+
platforms: linux/amd64,linux/arm64
49+
push: true
50+
tags: ${{ steps.meta.outputs.tags }}
51+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)