[mirror] Command-line application for uploading a site to a git-pages server
1name: CI
2
3on:
4 push:
5 pull_request:
6 workflow_dispatch:
7
8jobs:
9 check:
10 runs-on: debian-trixie
11 container:
12 image: docker.io/library/node:24-trixie-slim@sha256:4fc981bf8dfc5e36e15e0cb73c5761a14cabff0932dcad1cf26cd3c3425db5d4
13 steps:
14 - name: Check out source code
15 uses: https://code.forgejo.org/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16 - name: Set up toolchain
17 uses: https://code.forgejo.org/actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
18 with:
19 go-version: '>=1.25.6'
20 - name: Install dependencies
21 run: |
22 apt-get -y update
23 apt-get -y install ca-certificates
24 go install honnef.co/go/tools/cmd/staticcheck@latest
25 - name: Build application
26 run: |
27 go build
28 - name: Run static analysis
29 run: |
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: debian-trixie
38 container:
39 image: docker.io/library/node:24-trixie-slim@sha256:4fc981bf8dfc5e36e15e0cb73c5761a14cabff0932dcad1cf26cd3c3425db5d4
40 steps:
41 - name: Check out source code
42 uses: https://code.forgejo.org/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
43 - name: Set up toolchain
44 uses: https://code.forgejo.org/actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
45 with:
46 go-version: '>=1.25.6'
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-cli.$1-$2$3; }
56 build windows amd64 .exe
57 build windows arm64 .exe
58 build linux amd64
59 build linux arm64
60 build darwin arm64
61 - name: Create release
62 uses: https://code.forgejo.org/actions/forgejo-release@6a9510a9ea01b8b9b435933bf3c0fa45597ad530 # v2.11.3
63 with:
64 tag: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
65 release-dir: assets
66 direction: upload
67 override: true
68 prerelease: ${{ !startsWith(forge.event.ref, 'refs/tags/v') }}
69
70 package:
71 if: ${{ forge.ref == 'refs/heads/main' || startsWith(forge.event.ref, 'refs/tags/v') }}
72 needs: [check]
73 runs-on: debian-trixie
74 container:
75 image: docker.io/library/node:24-trixie-slim@sha256:4fc981bf8dfc5e36e15e0cb73c5761a14cabff0932dcad1cf26cd3c3425db5d4
76 steps:
77 - name: Install dependencies
78 run: |
79 apt-get -y update
80 apt-get -y install ca-certificates buildah qemu-user-binfmt
81 - name: Check out source code
82 uses: https://code.forgejo.org/actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
83 - name: Build container
84 run: |
85 printf '[storage]\ndriver="vfs"\nrunroot="/run/containers/storage"\ngraphroot="/var/lib/containers/storage"\n' | tee /etc/containers/storage.conf
86 buildah build --arch=amd64 --tag=container:amd64
87 buildah build --arch=arm64 --tag=container:arm64
88 buildah manifest create container container:amd64 container:arm64
89 env:
90 BUILDAH_ISOLATION: chroot
91 - if: ${{ forge.repository == 'git-pages/git-pages-cli' }}
92 name: Push container to Codeberg
93 run: |
94 buildah login --authfile=/tmp/authfile.json \
95 -u ${{ vars.PACKAGES_USER }} -p ${{ secrets.PACKAGES_TOKEN }} ${FORGE}
96 buildah manifest push --authfile=/tmp/authfile.json \
97 --all container "docker://${FORGE}/${{ forge.repository }}:${VER/v/}"
98 env:
99 FORGE: codeberg.org
100 VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}
101 - if: ${{ forge.repository == 'git-pages/git-pages-cli' }}
102 name: Push container to code.forgejo.org
103 run: |
104 buildah login --authfile=/tmp/authfile.json \
105 -u ${{ vars.PACKAGES_USER }} -p ${{ secrets.CFO_PACKAGES_TOKEN }} ${FORGE}
106 buildah manifest push --authfile=/tmp/authfile.json \
107 --all container "docker://${FORGE}/${{ forge.repository }}:${VER/v/}"
108 env:
109 FORGE: code.forgejo.org
110 VER: ${{ startsWith(forge.event.ref, 'refs/tags/v') && forge.ref_name || 'latest' }}