Skip to content

Fix insiders tags sometimes published to latest channel (#453) #42

Fix insiders tags sometimes published to latest channel (#453)

Fix insiders tags sometimes published to latest channel (#453) #42

Workflow file for this run

name: Release
on:
push:
branches: [main]
release:
types: [published]
permissions:
contents: read
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CI: true
NODE_VERSION: 24
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Resolve version
run: |
SHA_SHORT=$(git rev-parse --short HEAD)
echo "SHA_SHORT=$SHA_SHORT" >> $GITHUB_ENV
if [[ "${{ github.event_name }}" == "release" ]]; then
VERSION=${{ github.event.release.tag_name }}
VERSION=${VERSION#v}
else
VERSION=0.0.0-insiders.$SHA_SHORT
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
registry-url: "https://registry.npmjs.org"
- name: Install dependencies
run: pnpm install
- name: Calculate environment variables
run: |
echo "RELEASE_CHANNEL=$(node ./scripts/release-channel.js $VERSION)" >> $GITHUB_ENV
- name: Version package for insiders release
if: github.event_name != 'release'
run: pnpm version ${{ env.VERSION }} --force --no-git-tag-version
- name: Build Prettier Plugin
run: pnpm run build
- name: Test
run: pnpm run test
- name: Publish
run: pnpm publish --provenance --tag ${{ env.RELEASE_CHANNEL }} --no-git-checks