+63
-15
.forgejo/workflows/ci.yaml
+63
-15
.forgejo/workflows/ci.yaml
···
21
21
run: |
22
22
apt-get -y update
23
23
apt-get -y install ca-certificates
24
+
go install honnef.co/go/tools/cmd/staticcheck@latest
24
25
- name: Build service
25
26
run: |
26
-
go build -o bin/git-pages .
27
+
go build
27
28
- name: Run static analysis
28
29
run: |
29
-
go vet .
30
+
go vet
31
+
staticcheck
32
+
33
+
release:
34
+
# IMPORTANT: This workflow step will not work without the Releases unit enabled!
35
+
if: ${{ forge.ref == 'refs/heads/main' || startsWith(forge.event.ref, 'refs/tags/v') }}
36
+
needs: [check]
37
+
runs-on: codeberg-medium-lazy
38
+
container:
39
+
image: docker.io/library/node:24-trixie-slim@sha256:ef4ca6d078dd18322059a1f051225f7bbfc2bb60c16cbb5d8a1ba2cc8964fe8a
40
+
steps:
41
+
- name: Check out source code
42
+
uses: https://code.forgejo.org/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
43
+
- name: Set up toolchain
44
+
uses: https://code.forgejo.org/actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
45
+
with:
46
+
go-version: '>=1.25.0'
47
+
- name: Install dependencies
48
+
run: |
49
+
apt-get -y update
50
+
apt-get -y install ca-certificates
51
+
- name: Build release assets
52
+
# If you want more platforms to be represented, send a pull request.
53
+
run: |
54
+
set -x
55
+
build() { GOOS=$1 GOARCH=$2 go build -o assets/git-pages.$1-$2$3; }
56
+
build windows amd64 .exe
57
+
build linux amd64
58
+
build linux arm64
59
+
build darwin arm64
60
+
- name: Create release
61
+
uses: https://code.forgejo.org/actions/forgejo-release@v2.7.3
62
+
with:
63
+
tag: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
64
+
release-dir: assets
65
+
direction: upload
66
+
override: true
67
+
prerelease: ${{ !startsWith(forge.event.ref, 'refs/tags/v') }}
30
68
31
69
package:
32
-
if: ${{ forge.ref == 'refs/heads/main' }}
70
+
if: ${{ forge.ref == 'refs/heads/main' || startsWith(forge.event.ref, 'refs/tags/v') }}
33
71
needs: [check]
34
72
runs-on: codeberg-medium-lazy
35
73
container:
36
-
image: docker.io/library/node:24-trixie-slim@sha256:45babd1b4ce0349fb12c4e24bf017b90b96d52806db32e001e3013f341bef0fe
74
+
image: docker.io/library/node:24-trixie-slim@sha256:ef4ca6d078dd18322059a1f051225f7bbfc2bb60c16cbb5d8a1ba2cc8964fe8a
37
75
steps:
38
76
- name: Install dependencies
39
77
run: |
···
41
79
apt-get -y install buildah ca-certificates
42
80
- name: Check out source code
43
81
uses: https://code.forgejo.org/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
44
-
- if: ${{ forge.repository == 'git-pages/git-pages' && 'true' || 'false' }}
45
-
name: Log into container registry
82
+
- name: Build container
83
+
run: |
84
+
printf '[storage]\ndriver="vfs"\nrunroot="/run/containers/storage"\ngraphroot="/var/lib/containers/storage"\n' | tee /etc/containers/storage.conf
85
+
buildah build --arch=amd64 --tag=container:${VER}-amd64 .
86
+
buildah build --arch=arm64 --tag=container:${VER}-arm64 .
87
+
buildah manifest create container:${VER} \
88
+
container:${VER}-amd64 \
89
+
container:${VER}-arm64
90
+
env:
91
+
BUILDAH_ISOLATION: chroot
92
+
VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
93
+
- if: ${{ forge.repository == 'git-pages/git-pages' }}
94
+
name: Push container to Codeberg
46
95
run: |
47
-
buildah login --authfile=/tmp/authfile.json \
48
-
-u git-pages-bot -p ${{ secrets.PACKAGES_TOKEN }} codeberg.org
49
-
- name: Build container
50
-
uses: https://codeberg.org/actions/buildah-simple@main
51
-
with:
52
-
context: .
53
-
tag: "codeberg.org/git-pages/git-pages:latest"
54
-
push: ${{ forge.repository == 'git-pages/git-pages' && 'true' || 'false' }}
55
-
authfile: /tmp/authfile.json
96
+
buildah login --authfile=/tmp/authfile-${FORGE}.json \
97
+
-u ${{ vars.PACKAGES_USER }} -p ${{ secrets.PACKAGES_TOKEN }} ${FORGE}
98
+
buildah manifest push --authfile=/tmp/authfile-${FORGE}.json \
99
+
--all container:${VER} "docker://${FORGE}/${{ forge.repository }}:${VER/v/}"
100
+
env:
101
+
BUILDAH_ISOLATION: chroot
102
+
FORGE: codeberg.org
103
+
VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}