Skip to content

Commit

Permalink
[ci] set --tag on release (#10323)
Browse files Browse the repository at this point in the history
* chore(ci): set --tag on release

* chore: revert deletion

* fix: ignore job on forks
  • Loading branch information
natemoo-re authored Mar 5, 2024
1 parent e1477bb commit 50215ae
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ env:

jobs:
changelog:
name: Changelog PR or Release
if: ${{ github.repository_owner == 'withastro' }}
name: Changelog PR or Release
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -43,14 +43,32 @@ 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
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

0 comments on commit 50215ae

Please sign in to comment.