diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8a052d07..a2d7216d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -55,4 +55,19 @@ jobs: SPACELIFT_API_KEY_ID: ${{ secrets.SPACELIFT_API_KEY_ID }} SPACELIFT_API_KEY_SECRET: ${{ secrets.SPACELIFT_API_KEY_SECRET }} run: - spacectl provider create-version --type=nexus \ No newline at end of file + spacectl provider create-version --type=nexus + + - name: Publish provider + if: startsWith(github.ref, 'refs/tags/') + env: + GPG_KEY_ID: ${{ steps.import_gpg.outputs.keyid }} + SPACELIFT_API_KEY_ENDPOINT: https://spacelift.ktl.net + SPACELIFT_API_KEY_ID: ${{ secrets.SPACELIFT_API_KEY_ID }} + SPACELIFT_API_KEY_SECRET: ${{ secrets.SPACELIFT_API_KEY_SECRET }} + run: | + spacectl provider list-versions --type nexus -o json > versions.json + VERSION_NUMBER=${{ github.ref_name }} + VERSION_ID=$(jq --arg version "${VERSION_NUMBER#v}" '.versions[] | select(.number == $version) | .id' versions.json) + echo "VERSION_ID=${VERSION_ID}" >> $VERSION_ID + echo "Publishing ID: ${{ env.VERSION_ID }}" + spacectl provider publish-version --version=${{ env.VERSION_ID }}