Files
shared/.gitea/workflows/publish-go.yml
T
Gabriel20xx e2e21e84f7
Publish Go package / Publish shared Go module (push) Failing after 33s
Publish versioned shared Go module
2026-08-06 09:44:54 +02:00

54 lines
1.7 KiB
YAML

name: Publish Go package
on:
push:
tags:
- 'backend/v*'
jobs:
publish:
name: Publish shared Go module
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache: false
- name: Test Go module
working-directory: backend
run: go test ./...
- name: Install ZIP tools
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y zip
- name: Package Go module
env:
RELEASE_TAG: ${{ github.ref_name }}
run: bash scripts/package-go-module.sh "$RELEASE_TAG" "$RUNNER_TEMP/gitea-go-package"
- name: Publish to Gitea Package Registry
env:
PACKAGE_REGISTRY_USERNAME: ${{ secrets.PACKAGE_REGISTRY_USERNAME }}
PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
GITEA_GO_REGISTRY: https://repos.gfranz.ch/api/packages/Gabriel20xx/go/upload
run: |
set -euo pipefail
if [ -z "$PACKAGE_REGISTRY_USERNAME" ] || [ -z "$PACKAGE_REGISTRY_TOKEN" ]; then
echo 'PACKAGE_REGISTRY_USERNAME and PACKAGE_REGISTRY_TOKEN secrets are required.' >&2
exit 1
fi
package_file="$(find "$RUNNER_TEMP/gitea-go-package" -maxdepth 1 -type f -name '*.zip' -print -quit)"
test -n "$package_file"
curl --fail-with-body --user "$PACKAGE_REGISTRY_USERNAME:$PACKAGE_REGISTRY_TOKEN" \
--upload-file "$package_file" \
"$GITEA_GO_REGISTRY"