-
Notifications
You must be signed in to change notification settings - Fork 31
chore: release slack-cli v4.1.1 #553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
slack-cli-releaser
wants to merge
5
commits into
main
Choose a base branch
from
rc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9742434
ci: test release candidate in pull request when available
zimeg dce228c
test: attempt to release candidate from pull request
zimeg af2d652
fix: use full refspec for pushing to rc branch
zimeg d5e03c4
Merge af2d652565473af7b41ab3bff52d0e94ac5f13ba into afcb85d190b6b7995…
zimeg 59c24ed
chore: release slack-cli v4.1.1
slack-cli-releaser[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| workflow_dispatch: | ||
|
|
||
| concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
|
||
| jobs: | ||
| rc: | ||
| name: RC | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| steps: | ||
| - name: Gather credentials | ||
| id: credentials | ||
| uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 | ||
| with: | ||
| app-id: ${{ secrets.GH_APP_ID_RELEASER }} | ||
| private-key: ${{ secrets.GH_APP_PRIVATE_KEY_RELEASER }} | ||
|
|
||
| - name: Checkout repo | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: true | ||
| token: ${{ steps.credentials.outputs.token }} | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Decide next version | ||
| id: version | ||
| env: | ||
| GH_TOKEN: ${{ steps.credentials.outputs.token }} | ||
| run: | | ||
| # Get the latest release tag | ||
| LATEST_TAG=$(git describe --tags --match 'v*.*.*' --abbrev=0) | ||
|
|
||
| # Get PR numbers since latest tag | ||
| PR_NUMBERS=$(git log "${LATEST_TAG}..HEAD" --oneline | grep -oP '#\K[0-9]+' || true) | ||
|
|
||
| if [ -z "$PR_NUMBERS" ]; then | ||
| echo "No new PRs since $LATEST_TAG" | ||
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Search for highest semver label | ||
| SEMVER="patch" | ||
| for PR in $PR_NUMBERS; do | ||
| LABELS=$(gh pr view "$PR" --json labels --jq '.labels[].name' 2>/dev/null || true) | ||
| if echo "$LABELS" | grep -q "semver:major"; then | ||
| SEMVER="major" | ||
| break | ||
| elif echo "$LABELS" | grep -q "semver:minor"; then | ||
| SEMVER="minor" | ||
| fi | ||
| done | ||
|
|
||
| # Parse current version | ||
| VERSION="${LATEST_TAG#v}" | ||
| MAJOR=$(echo "$VERSION" | cut -d. -f1) | ||
| MINOR=$(echo "$VERSION" | cut -d. -f2) | ||
| PATCH=$(echo "$VERSION" | cut -d. -f3) | ||
|
|
||
| # Compute next version | ||
| case "$SEMVER" in | ||
| major) | ||
| NEXT_VERSION="$((MAJOR + 1)).0.0" | ||
| ;; | ||
| minor) | ||
| NEXT_VERSION="${MAJOR}.$((MINOR + 1)).0" | ||
| ;; | ||
| patch) | ||
| NEXT_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))" | ||
| ;; | ||
| esac | ||
|
|
||
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||
| echo "next=$NEXT_VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "semver=$SEMVER" >> "$GITHUB_OUTPUT" | ||
| echo "Bumping $LATEST_TAG to v$NEXT_VERSION" | ||
|
|
||
| - name: Generate release commit | ||
| if: steps.version.outputs.has_changes == 'true' | ||
| env: | ||
| RELEASE_VERSION: ${{ steps.version.outputs.next }} | ||
| run: | | ||
| git config user.name "slack-cli-releaser[bot]" | ||
| git config user.email "122933866+slack-cli-releaser[bot]@users.noreply.github.com" | ||
| make rc RELEASE_VERSION="$RELEASE_VERSION" | ||
| git push origin "HEAD:refs/heads/rc" --force | ||
|
|
||
| - name: Create or update release PR | ||
| if: steps.version.outputs.has_changes == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ steps.credentials.outputs.token }} | ||
| RELEASE_VERSION: ${{ steps.version.outputs.next }} | ||
| SEMVER: ${{ steps.version.outputs.semver }} | ||
| run: | | ||
| PR_TITLE="chore: release slack-cli v${RELEASE_VERSION}" | ||
| PR_BODY=$(cat <<EOF | ||
| ### Summary | ||
|
|
||
| Release v${RELEASE_VERSION}. After merging, create a [GitHub Release](https://github.com/${{ github.repository }}/releases/new?tag=v${RELEASE_VERSION}&title=v${RELEASE_VERSION}) to tag and trigger the release pipeline. | ||
|
|
||
| ### Testing | ||
|
|
||
| Install the [dev-build](https://github.com/slackapi/slack-cli/releases/tag/dev-build) and verify changes. | ||
|
|
||
| ### Requirements | ||
|
|
||
| - [x] I've read and understood the [Contributing Guidelines](https://github.com/slackapi/slack-cli/blob/main/.github/CONTRIBUTING.md) and have done my best effort to follow them. | ||
| - [x] I've read and agree to the [Code of Conduct](https://slackhq.github.io/code-of-conduct). | ||
| EOF | ||
| ) | ||
|
|
||
| # Check if a PR from rc already exists | ||
| EXISTING_PR=$(gh pr list --head rc --base main --json number --jq '.[0].number' 2>/dev/null || true) | ||
|
|
||
| if [ -n "$EXISTING_PR" ]; then | ||
| gh pr edit "$EXISTING_PR" --remove-label "semver:patch" --remove-label "semver:minor" --remove-label "semver:major" 2>/dev/null || true | ||
| gh pr edit "$EXISTING_PR" --title "$PR_TITLE" --body "$PR_BODY" --milestone "Next Release" --label "release" --label "semver:${SEMVER}" | ||
| echo "Updated PR #$EXISTING_PR" | ||
| else | ||
| gh pr create --head rc --base main --title "$PR_TITLE" --body "$PR_BODY" --milestone "Next Release" --label "release" --label "semver:${SEMVER}" | ||
| echo "Created new release PR" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔬 note: Alongside #539 we ought use separate paths but no blocker I think?