From 0454014c874409549036632ee3f077e97190b72d Mon Sep 17 00:00:00 2001 From: maddocash <31258232+maddocash@users.noreply.github.com> Date: Mon, 23 Sep 2024 15:06:04 +0100 Subject: [PATCH] Update release process for spacelift --- .github/workflows/release.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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