diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 54e7b8b..d262022 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,4 +30,28 @@ jobs: args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} \ No newline at end of file + GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} + + - name: Release new version to spacelift + 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 create-version --type=splitpolicies + + - 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 splitpolicies -o json > versions.json + VERSION_NUMBER=${{ github.ref_name }} + VERSION_ID=$(jq -r --arg version "${VERSION_NUMBER#v}" '.versions[] | select(.number == $version) | .id' versions.json) + echo "Publishing ID: $VERSION_ID" + spacectl provider publish-version --version=$VERSION_ID \ No newline at end of file