tangled
alpha
login
or
join now
whitequark.org
/
git-pages-cli
1
fork
atom
[mirror] Command-line application for uploading a site to a git-pages server
1
fork
atom
overview
issues
pulls
pipelines
CI: handle tagging and publish releases.
whitequark.org
3 months ago
947e345e
583af893
+56
-14
2 changed files
expand all
collapse all
unified
split
.forgejo
workflows
ci.yaml
Dockerfile
+56
-13
.forgejo/workflows/ci.yaml
···
24
24
go install honnef.co/go/tools/cmd/staticcheck@latest
25
25
- name: Build application
26
26
run: |
27
27
-
go build .
27
27
+
go build
28
28
- name: Run static analysis
29
29
run: |
30
30
-
go vet .
31
31
-
staticcheck .
30
30
+
go vet
31
31
+
staticcheck
32
32
+
33
33
+
release:
34
34
+
# IMPORTANT: This workflow step will not work without the Releases unit enabled!
35
35
+
if: ${{ forge.ref == 'refs/heads/main' || startsWith(forge.event.ref, 'refs/tags/v') }}
36
36
+
needs: [check]
37
37
+
runs-on: codeberg-small-lazy
38
38
+
container:
39
39
+
image: docker.io/library/node:24-trixie-slim@sha256:ef4ca6d078dd18322059a1f051225f7bbfc2bb60c16cbb5d8a1ba2cc8964fe8a
40
40
+
steps:
41
41
+
- name: Check out source code
42
42
+
uses: https://code.forgejo.org/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
43
43
+
- name: Set up toolchain
44
44
+
uses: https://code.forgejo.org/actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6
45
45
+
with:
46
46
+
go-version: '>=1.25.0'
47
47
+
- name: Install dependencies
48
48
+
run: |
49
49
+
apt-get -y update
50
50
+
apt-get -y install ca-certificates
51
51
+
- name: Build release assets
52
52
+
# If you want more platforms to be represented, send a pull request.
53
53
+
run: |
54
54
+
set -x
55
55
+
build() { GOOS=$1 GOARCH=$2 go build -o assets/git-pages-cli.$1-$2$3; }
56
56
+
build windows amd64 .exe
57
57
+
build windows arm64 .exe
58
58
+
build linux amd64
59
59
+
build linux arm64
60
60
+
build darwin arm64
61
61
+
- name: Create release
62
62
+
uses: https://code.forgejo.org/actions/forgejo-release@v2.7.3
63
63
+
with:
64
64
+
tag: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
65
65
+
release-dir: assets
66
66
+
direction: upload
67
67
+
override: true
68
68
+
prerelease: ${{ !startsWith(forge.event.ref, 'refs/tags/v') }}
32
69
33
70
package:
34
34
-
if: ${{ forge.ref == 'refs/heads/main' }}
71
71
+
if: ${{ forge.ref == 'refs/heads/main' || startsWith(forge.event.ref, 'refs/tags/v') }}
35
72
needs: [check]
36
73
runs-on: codeberg-small-lazy
37
74
container:
···
43
80
apt-get -y install buildah ca-certificates
44
81
- name: Check out source code
45
82
uses: https://code.forgejo.org/actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
46
46
-
- if: ${{ forge.repository == 'git-pages/git-pages-cli' }}
47
47
-
name: Log into container registry
48
48
-
run: |
49
49
-
buildah login --authfile=/tmp/authfile.json \
50
50
-
-u git-pages-bot -p ${{ secrets.PACKAGES_TOKEN }} codeberg.org
51
83
- name: Build container
52
84
run: |
53
85
printf '[storage]\ndriver="vfs"\nrunroot="/run/containers/storage"\ngraphroot="/var/lib/containers/storage"\n' | tee /etc/containers/storage.conf
54
54
-
buildah build --arch=amd64 --tag="codeberg.org/git-pages/git-pages-cli:latest-amd64" --isolation=chroot .
55
55
-
buildah build --arch=arm64 --tag="codeberg.org/git-pages/git-pages-cli:latest-arm64" --isolation=chroot .
56
56
-
buildah manifest create codeberg.org/git-pages/git-pages-cli:latest codeberg.org/git-pages/git-pages-cli:latest-amd64 codeberg.org/git-pages/git-pages-cli:latest-arm64
86
86
+
buildah build --arch=amd64 --tag=container:${VER}-amd64 .
87
87
+
buildah build --arch=arm64 --tag=container:${VER}-arm64 .
88
88
+
buildah manifest create container:${VER} \
89
89
+
container:${VER}-amd64 \
90
90
+
container:${VER}-arm64
91
91
+
env:
92
92
+
BUILDAH_ISOLATION: chroot
93
93
+
VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
57
94
- if: ${{ forge.repository == 'git-pages/git-pages-cli' }}
58
95
name: Push container
59
96
run: |
60
60
-
env BUILDAH_ISOLATION=chroot REGISTRY_AUTH_FILE=/tmp/authfile.json buildah manifest push --all codeberg.org/git-pages/git-pages-cli:latest "docker://codeberg.org/git-pages/git-pages-cli:latest"
97
97
+
buildah login --authfile=/tmp/authfile.json \
98
98
+
-u ${{ vars.PACKAGES_USER }} -p ${{ secrets.PACKAGES_TOKEN }} codeberg.org
99
99
+
buildah manifest push --authfile=/tmp/authfile.json \
100
100
+
--all container:${VER} "docker://codeberg.org/${{ forge.repository }}:${VER/v/}"
101
101
+
env:
102
102
+
BUILDAH_ISOLATION: chroot
103
103
+
VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
-1
Dockerfile
···
10
10
FROM scratch
11
11
COPY --from=builder /etc/ssl/cert.pem /etc/ssl/cert.pem
12
12
COPY --from=builder /build/git-pages-cli /bin/git-pages-cli
13
13
-
14
13
ENTRYPOINT ["git-pages-cli"]