diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fbbdd59452b..8ad9019cd8b 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -339,10 +339,6 @@ This section is dedicated to the maintainers of this project. ### Releases -Before running a release: - -- **`meta/meta.go`**: The versions must be appropriately updated. - To cut a release, go to the repository in GitHub and click on the `Actions` tab. Select the `Release` workflow on the left-hand menu. @@ -352,4 +348,6 @@ Click on the `Run workflow` button. Select the branch to cut the release from (default is main). Input the `Release version number` which is the Semantic Release number including -the `v` prefix (i.e. `v1.4.0`) and click `Run workflow` to kickoff the release. +the `v` prefix (i.e. `v1.4.0` or `v1.4.0-alpha.1`) and click `Run workflow` to kickoff the release. + +The (deprecated) version information in `meta/meta.go` will be updated automatically and a commit will be pushed. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b59bd7cdd31..14ee4fc95e1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,9 +20,26 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ steps.changelog-version.outputs.version }} + version_only: ${{ steps.changelog-version.outputs.version_only }} + prerelease: ${{ steps.changelog-version.outputs.prerelease }} steps: - id: changelog-version - run: echo "version=$(echo "${{ inputs.versionNumber }}" | cut -c 2-)" >> "$GITHUB_OUTPUT" + run: | + version="${{ inputs.versionNumber }}" + version="${version#v}" # Remove leading "v" if present + version_only="${version%%-*}" + prerelease="${version#*-}" + + # If there's no dash, set prerelease to empty + if [ "$version" = "$version_only" ]; then + prerelease="" + fi + + { + echo "version=$version" + echo "version_only=$version_only" + echo "prerelease=$prerelease" + } >> "$GITHUB_OUTPUT" changelog: needs: [ changelog-version, meta-version ] @@ -70,8 +87,10 @@ jobs: # Avoid persisting GITHUB_TOKEN credentials as they take priority over our service account PAT for `git push` operations # More details: https://github.com/actions/checkout/blob/b4626ce19ce1106186ddf9bb20e706842f11a7c3/adrs/0153-checkout-v2.md#persist-credentials persist-credentials: false - - name: Update meta package SDKVersion - run: sed -i "s/var SDKVersion =.*/var SDKVersion = \"${{ needs.changelog-version.outputs.version }}\"/" meta/meta.go + - name: Update meta package SDKVersion and SDKPrerelease + run: | + sed -i "s/var SDKVersion =.*/var SDKVersion = \"${{ needs.changelog-version.outputs.version_only }}\"/" meta/meta.go + sed -i "s/var SDKPrerelease =.*/var SDKPrerelease = \"${{ needs.changelog-version.outputs.prerelease }}\"/" meta/meta.go - name: Git push meta run: | git config --global user.name "${{ vars.TF_DEVEX_CI_COMMIT_AUTHOR }}"