Add go package upload

This commit is contained in:
Ryan McGuire 2024-12-16 16:48:11 -05:00
parent bccd91ca30
commit 09e5cdd201

View File

@ -47,15 +47,19 @@ jobs:
GOPRIVATE: gitea.libretechconsulting.com/*
API_TOKEN: ${{ secrets.API_TOKEN }} # Replace with a Gitea token stored in repository secrets
run: |
go list --json
# Set up netrc for Gitea
echo "machine ${GO_GIT_HOST} login ${GITHUB_REPOSITORY_OWNER} password ${API_TOKEN}" > ~/.netrc
chmod 0600 ~/.netrc
go mod download -x --json ${GO_MOD_PATH}@${{ github.ref_name }} 2>&1
# Package and get mod info
go mod download -x --json ${GO_MOD_PATH}@${{ github.ref_name }} | tee package.json
if [[ $? -ne 0 ]]; then
echo "Failed to generage go package archive for ${GO_MOD_PATH}@${{ github.ref_name }}"
exit 1
fi
ZIPFILE=$( jq .Zip < package.json )
# Upload to Gitea go registry
echo "Uploading go package ${ZIPFILE}"
curl -X PUT \
-H "Authorization: token ${API_TOKEN}" \