0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

[ci] set --tag on release (#10323)

* chore(ci): set --tag on release

* chore: revert deletion

* fix: ignore job on forks
This commit is contained in:
Nate Moore 2024-03-05 16:43:24 -06:00 committed by GitHub
parent e1477bb3d6
commit 50215ae731
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
@ -44,13 +44,31 @@ 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: