From a1d1750a79dc7ee7e02362598f1dd9092185794b Mon Sep 17 00:00:00 2001 From: Marcel_Henselin Date: Tue, 17 Mar 2026 16:21:23 +0000 Subject: [PATCH] chore: update publish pipeline (#90) [skip ci] ## Description relates to #1234 ## Checklist - [ ] Issue was linked above - [ ] Code format was applied: `make fmt` - [ ] Examples were added / adjusted (see `examples/` directory) - [x] Docs are up-to-date: `make generate-docs` (will be checked by CI) - [ ] Unit tests got implemented or updated - [ ] Acceptance tests got implemented or updated (see e.g. [here](https://github.com/stackitcloud/terraform-provider-stackit/blob/f5f99d170996b208672ae684b6da53420e369563/stackit/internal/services/dns/dns_acc_test.go)) - [x] Unit tests are passing: `make test` (will be checked by CI) - [x] No linter issues: `make lint` (will be checked by CI) Co-authored-by: Marcel S. Henselin Reviewed-on: https://tf-provider.git.onstackit.cloud/stackit-dev-tools/terraform-provider-stackitprivatepreview/pulls/90 --- .github/workflows/publish.yaml | 36 ++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index a4413154..4befbc3a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -3,6 +3,8 @@ name: Publish run-name: Publish by @${{ github.actor }} on: + workflow_dispatch: + push: tags: - 'v0.*' @@ -15,7 +17,6 @@ env: jobs: config: name: Check GoReleaser config - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: - name: Checkout @@ -28,13 +29,12 @@ jobs: publish: name: "Publish provider" - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') needs: config runs-on: ubuntu-latest permissions: actions: read # Required to identify workflow run. checks: write # Required to add status summary. - contents: read # Required to checkout repository. + contents: write # Required to checkout repository. pull-requests: write # Required to add PR comment. steps: - name: Install needed tools @@ -81,15 +81,15 @@ jobs: gpg --import ~/private.key.pem rm ~/private.key.pem - - name: Run GoReleaser with SNAPSHOT - if: github.event_name == 'workflow_dispatch' - id: goreleaser - env: - GITHUB_TOKEN: ${{ env.FORGEJO_TOKEN }} - GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }} - uses: goreleaser/goreleaser-action@v7 - with: - args: release --skip publish --clean --snapshot +# - name: Run GoReleaser with SNAPSHOT +# if: github.event_name == 'workflow_dispatch' +# id: goreleaser +# env: +# GITHUB_TOKEN: ${{ env.FORGEJO_TOKEN }} +# GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }} +# uses: goreleaser/goreleaser-action@v7 +# with: +# args: release --skip publish --clean --snapshot - name: Run GoReleaser if: github.event_name != 'workflow_dispatch' @@ -105,9 +105,14 @@ jobs: run: | echo "${{ secrets.PUBLIC_KEY_PEM }}" >public_key.pem - - name: Prepare provider directory structure + - name: Determine version + id: get_version run: | VERSION=$(jq -r .version < dist/metadata.json) + echo "version=${VERSIO)N}" >> "$GITHUB_OUTPUT" + + - name: Prepare provider directory structure + run: | go run generator/main.go \ publish \ --namespace=mhenselin \ @@ -116,7 +121,7 @@ jobs: --domain=tfregistry.sysops.stackit.rocks \ --gpgFingerprint="${{ secrets.GPG_FINGERPRINT }}" \ --gpgPubKeyFile=public_key.pem \ - --version=${VERSION} + --version=${{ steps.get_version.outputs.version }} - name: Prepare documentation nav file run: | @@ -141,6 +146,7 @@ jobs: run: | set -e ssh -o StrictHostKeyChecking=no ubuntu@${{ vars.DOCS_SERVER_IP }} 'rm -rf /srv/www/docs' - echo "${{ github.ref_name }}" >docs/_version.txt + echo "${{ steps.get_version.outputs.version }}" >docs/_version.txt + # echo "${{ github.ref_name }}" >docs/_version.txt scp -o StrictHostKeyChecking=no -r docs ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/ scp -o StrictHostKeyChecking=no nav.md ubuntu@${{ vars.DOCS_SERVER_IP }}:/srv/www/