diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index 9bb8927..a7a85c9 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -11,32 +11,32 @@ jobs: permissions: contents: write id-token: write - issues: write - pull-requests: write - actions: read steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout with: fetch-depth: 0 - - uses: googleapis/release-please-action@c2a5a2bd6a758a0937f1ddb1e8950609867ed15c # v4.3.0 https://github.com/googleapis/release-please-action/commits/main/ - name: release-please - id: release-please - with: - skip-github-pull-request: true - skip-github-release: false - config-file: release-please-config-rc.json - manifest-file: .release-please-manifest.json - - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 https://github.com/actions/checkout - if: steps.release-please.outputs.version - with: - fetch-depth: 0 - - uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 https://github.com/actions/setup-go - if: steps.release-please.outputs.version - with: - go-version-file: 'go.mod' - cache: true + - name: Create and Push RC Tag with Git + run: | + BASE_VERSION=$(echo "$GITHUB_REF" | sed 's/refs\/heads\/release\///') + echo "Base version is: $BASE_VERSION" + git fetch --tags + LATEST_RC_NUM=$(git tag | grep "^${BASE_VERSION}-rc." | sed 's/.*-rc.//' | sort -n | tail -1) + if [ -z "$LATEST_RC_NUM" ]; then + NEXT_RC_NUM=0 + else + NEXT_RC_NUM=$((LATEST_RC_NUM + 1)) + fi + NEXT_RC_TAG="${BASE_VERSION}-rc.${NEXT_RC_NUM}" + echo "Calculated next RC tag: $NEXT_RC_TAG" + + # Configure git user + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + + # Create and push the new tag + git tag "$NEXT_RC_TAG" -m "Release Candidate $NEXT_RC_TAG" + git push origin "$NEXT_RC_TAG" - name: retrieve GPG Credentials - if: steps.release-please.outputs.version uses: rancher-eio/read-vault-secrets@main with: secrets: | @@ -44,7 +44,6 @@ jobs: secret/data/github/repo/${{ github.repository }}/signing/gpg privateKeyId | GPG_KEY_ID ; secret/data/github/repo/${{ github.repository }}/signing/gpg privateKey | GPG_KEY - name: import_gpg_key - if: steps.release-please.outputs.version env: GPG_PASSPHRASE: ${{ env.GPG_PASSPHRASE }} GPG_KEY_ID: ${{ env.GPG_KEY_ID }} @@ -64,8 +63,7 @@ jobs: echo "Importing gpg key" echo "${GPG_KEY}" | gpg --import --batch > /dev/null || { echo "Failed to import GPG key"; exit 1; } - name: Run GoReleaser - if: steps.release-please.outputs.version - uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 + uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.0 https://github.com/goreleaser/goreleaser-action with: args: release --clean env: diff --git a/.goreleaser.yml b/.goreleaser.yml index 710ce1d..80a3b6f 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -54,8 +54,6 @@ release: extra_files: - glob: 'terraform-registry-manifest.json' name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json' - # If you want to manually examine the release before its live, uncomment this line: - # draft: true - prerelease: false + prerelease: auto changelog: disable: true diff --git a/aspell_custom.txt b/aspell_custom.txt index 690469b..645ecff 100644 --- a/aspell_custom.txt +++ b/aspell_custom.txt @@ -16,3 +16,4 @@ assignees backport url gpg +rc diff --git a/release-please-config-rc.json b/release-please-config-rc.json deleted file mode 100644 index 3305eba..0000000 --- a/release-please-config-rc.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "packages": { - ".": { - "release-type": "go", - "prerelease": true, - "include-v-in-tag": true, - "include-component-in-tag": false, - "always-update": true, - "skip-changelog": true, - "versioning": "prerelease" - } - }, - "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json" -}