Skip to content
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

[ci] set --tag on release #10323

Merged
merged 5 commits into from
Mar 5, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ env:
jobs:
changelog:
name: Changelog PR or Release
if: ${{ github.repository_owner == 'withastro' }}
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -43,14 +42,33 @@ jobs:

- name: Build Packages
run: pnpm run build

- name: Set PUBLISH_FLAGS variable
id: tag
run: |
BRANCH_NAME="${GITHUB_REF##*/}"
if [ "$BRANCH_NAME" = "main" ]; then
# do not set any flags (`latest` is the default)
echo "PUBLISH_FLAGS=" >> $GITHUB_ENV
elif [ "$BRANCH_NAME" = "next" ]; then
# just use `--tag next`
echo "PUBLISH_FLAGS=--tag next" >> $GITHUB_ENV
else
# extract the integer prefix from the branch name
VERSION_NUMBER="${BRANCH_NAME%%-*}"
# pass a shorthand tag like `--tag v3`
echo "PUBLISH_FLAGS=--tag v$VERSION_NUMBER" >> $GITHUB_ENV
fi

- name: Create Release Pull Request or Publish
if: ${{ github.repository_owner == 'withastro' }}
id: changesets
uses: changesets/action@v1
with:
# Note: pnpm install after versioning is necessary to refresh lockfile
# Note: Run custom version script which runs pnpm install
# the install step is necessary to refresh lockfile after versioning
version: pnpm run version
publish: pnpm exec changeset publish
publish: pnpm exec changeset publish $PUBLISH_FLAGS
commit: "[ci] release"
title: "[ci] release"
env:
Expand Down
Loading