diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8f01521..8c4a115 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -7,6 +7,8 @@ env: PACKAGE_NAME: eia-api-go BINARY_PATH: bin BINARY_NAME: eia-client + GO_MOD_PATH: gitea.libretechconsulting.com/50w/eia-api-go + GOPRIVATE: gitea.libretechconsulting.com/* # DOCKER_HOST: "unix:///var/run/user/1000/docker.sock" # DOCKER_ORG: "rmcguire" # DOCKER_LATEST: "latest" @@ -26,7 +28,7 @@ jobs: - name: Build Binary run: make all # Build the binary - - name: Upload Artifact to Gitea + - name: Upload Client Binary to Generic Registry env: API_TOKEN: ${{ secrets.API_TOKEN }} # Replace with a Gitea token stored in repository secrets run: | @@ -40,6 +42,18 @@ jobs: exit 1 fi + - name: Generate and Upload Package to Go Registry + run: | + ZIPFILE=$( go mod download --json ${GO_MOD_PATH}@${{ github.ref_name }} | jq .Zip ) + if [ $? -ne 0 ]; then + echo "Failed to generage go package archive for ${GO_MOD_PATH}@${{ github.ref_name }}" + exit 1 + fi + curl -X PUT \ + -H "Authorization: token ${API_TOKEN}" \ + --upload-file ${ZIPFILE} \ + "${GITHUB_SERVER_URL}/api/packages/${GITHUB_REPOSITORY_OWNER}/go/upload" + publish: runs-on: ubuntu-latest needs: build # Ensure this stage runs only after 'build' is successful