Files
archipelago/.github/workflows/publish.yml
T
2026-11-05 00:32:45 +11:00

57 lines
2.1 KiB
YAML

name: publish
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: publish
cancel-in-progress: false
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install skopeo
run: sudo apt-get update && sudo apt-get install -y skopeo
# A mirror carries its own Actions secrets. An empty token here logs in
# as an empty password, so the run reports "unauthorized" instead of
# naming what is missing.
- name: Check DEPLOY_TOKEN is configured
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: |
if [ -z "$DEPLOY_TOKEN" ]; then
echo "::error::DEPLOY_TOKEN is not set for this repository, so the publish cannot log in to git.catlow.cloud. Set the secret here, or publish from the Gitea primary."
exit 1
fi
- name: Log in to the Gitea registry
run: echo "${{ secrets.DEPLOY_TOKEN }}" | skopeo login git.catlow.cloud -u "${{ github.actor }}" --password-stdin
- name: Publish packages and the signed catalogue
env:
ARCHIPELAGO_CATALOGUE_KEY: ${{ secrets.ARCHIPELAGO_CATALOGUE_KEY }}
run: scripts/publish.sh git.catlow.cloud/sam/archipelago
# A Gitea package belongs to its owner, not a repository, so a new one
# is linked here; linking is per package, so this is a no-op once done.
- name: Link new packages to this repository
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
run: |
api=https://git.catlow.cloud/api/v1
auth="Authorization: token $DEPLOY_TOKEN"
for page in 1 2 3 4 5 6 7 8; do
curl -fsS -H "$auth" "$api/packages/sam?type=container&limit=50&page=$page" |
jq -r '.[] | select(.repository == null and (.name | startswith("archipelago/"))) | .name | @uri'
done | sort -u | while read -r name; do
curl -fsS -o /dev/null -X POST -H "$auth" "$api/packages/sam/container/$name/-/link/archipelago"
done