Publish versioned shared Go module
Publish Go package / Publish shared Go module (push) Failing after 33s
Publish Go package / Publish shared Go module (push) Failing after 33s
This commit is contained in:
1 parent
90080a8425
commit
e2e21e84f7
8 files changed
+125
-16
No files matched your search
@@ -0,0 +1,53 @@
|
||||
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"
|
||||
Reference in new issue
Block a user