Skip to content

Commit b46c258

Browse files
committed
Added github workflows next to gitea's workflows
1 parent 7bc33b1 commit b46c258

2 files changed

Lines changed: 132 additions & 0 deletions

File tree

.github/workflows/container.yaml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Container image
2+
3+
# Mirrors .gitea/workflows/container.yaml — publishes a multi-arch
4+
# (amd64 + arm64) image to the GitHub Container Registry whenever the
5+
# Gitea→GitHub mirror pushes a `v*` tag. Image lands at
6+
# ghcr.io/axodouble/quptime with tags :vX.Y.Z, :X.Y, and :latest.
7+
on:
8+
push:
9+
tags:
10+
- 'v*'
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
jobs:
17+
image:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
26+
- name: Set up Buildx
27+
uses: docker/setup-buildx-action@v3
28+
29+
# GHCR namespaces must be lowercase. Lowercase the repository
30+
# path once and reuse below so a mixed-case org/repo (e.g.
31+
# Axodouble/QUptime) still resolves to a valid image reference.
32+
- name: Resolve image name
33+
id: img
34+
run: |
35+
repo='${{ github.repository }}'
36+
echo "ref=ghcr.io/${repo,,}" >> "$GITHUB_OUTPUT"
37+
38+
- name: Compute version
39+
id: ver
40+
run: |
41+
echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
42+
43+
- name: Login to GHCR
44+
uses: docker/login-action@v3
45+
with:
46+
registry: ghcr.io
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Docker metadata
51+
id: meta
52+
uses: docker/metadata-action@v5
53+
with:
54+
images: ${{ steps.img.outputs.ref }}
55+
tags: |
56+
type=semver,pattern={{version}}
57+
type=semver,pattern={{major}}.{{minor}}
58+
type=raw,value=latest
59+
60+
- name: Build and push
61+
uses: docker/build-push-action@v6
62+
with:
63+
context: .
64+
file: ./docker/Dockerfile
65+
platforms: linux/amd64,linux/arm64
66+
push: true
67+
tags: ${{ steps.meta.outputs.tags }}
68+
labels: ${{ steps.meta.outputs.labels }}
69+
build-args: |
70+
VERSION=${{ steps.ver.outputs.version }}
71+
cache-from: type=gha
72+
cache-to: type=gha,mode=max

.github/workflows/release.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
# Mirrors .gitea/workflows/release.yaml — fires when the Gitea→GitHub
4+
# mirror pushes a `v*` tag, builds static Linux binaries for amd64 +
5+
# arm64, and publishes them to GitHub Releases alongside the Gitea
6+
# release the same tag produces upstream.
7+
on:
8+
push:
9+
tags:
10+
- 'v*'
11+
12+
permissions:
13+
contents: write
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Go
23+
uses: actions/setup-go@v5
24+
with:
25+
go-version: '1.24'
26+
check-latest: false
27+
cache: false
28+
29+
- name: Test
30+
run: go test -race ./...
31+
32+
- name: Build binaries
33+
env:
34+
CGO_ENABLED: '0'
35+
run: |
36+
set -euo pipefail
37+
VERSION="${GITHUB_REF_NAME}"
38+
mkdir -p dist
39+
for arch in amd64 arm64; do
40+
out="dist/qu-${VERSION}-linux-${arch}"
41+
echo "building ${out}"
42+
GOOS=linux GOARCH="${arch}" \
43+
go build \
44+
-trimpath \
45+
-ldflags "-s -w -X main.version=${VERSION}" \
46+
-o "${out}" \
47+
./cmd/qu
48+
done
49+
(cd dist && sha256sum qu-* > SHA256SUMS)
50+
ls -lh dist
51+
52+
- name: Publish release
53+
uses: softprops/action-gh-release@v2
54+
with:
55+
files: |
56+
dist/qu-*
57+
dist/SHA256SUMS
58+
fail_on_unmatched_files: true
59+
generate_release_notes: true
60+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)