Add go package upload
This commit is contained in:
parent
bccd91ca30
commit
09e5cdd201
@ -47,15 +47,19 @@ jobs:
|
|||||||
GOPRIVATE: gitea.libretechconsulting.com/*
|
GOPRIVATE: gitea.libretechconsulting.com/*
|
||||||
API_TOKEN: ${{ secrets.API_TOKEN }} # Replace with a Gitea token stored in repository secrets
|
API_TOKEN: ${{ secrets.API_TOKEN }} # Replace with a Gitea token stored in repository secrets
|
||||||
run: |
|
run: |
|
||||||
go list --json
|
# Set up netrc for Gitea
|
||||||
echo "machine ${GO_GIT_HOST} login ${GITHUB_REPOSITORY_OWNER} password ${API_TOKEN}" > ~/.netrc
|
echo "machine ${GO_GIT_HOST} login ${GITHUB_REPOSITORY_OWNER} password ${API_TOKEN}" > ~/.netrc
|
||||||
chmod 0600 ~/.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
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Failed to generage go package archive for ${GO_MOD_PATH}@${{ github.ref_name }}"
|
echo "Failed to generage go package archive for ${GO_MOD_PATH}@${{ github.ref_name }}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
ZIPFILE=$( jq .Zip < package.json )
|
ZIPFILE=$( jq .Zip < package.json )
|
||||||
|
|
||||||
|
# Upload to Gitea go registry
|
||||||
echo "Uploading go package ${ZIPFILE}"
|
echo "Uploading go package ${ZIPFILE}"
|
||||||
curl -X PUT \
|
curl -X PUT \
|
||||||
-H "Authorization: token ${API_TOKEN}" \
|
-H "Authorization: token ${API_TOKEN}" \
|
||||||
|
Loading…
Reference in New Issue
Block a user