Add vitest temp file to gitignore (#2637) #1258
This file contains 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
name: Changesets | |
on: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: changeset-${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
changelog: | |
runs-on: ubuntu-latest | |
if: github.repository_owner == 'shopify' | |
name: Changelog PR or Release | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
# A JSON array to present the published packages. The format is [{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}] | |
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }} | |
latest: ${{ env.latest }} | |
latestBranch: ${{ env.latestBranch }} | |
steps: | |
- name: Flags | |
id: flags | |
run: | | |
# IMPORTANT: Update this latestBranch whenever we move to a new major version: | |
echo "latestBranch=2024-10" >> $GITHUB_ENV | |
echo "latest=${{ github.ref_name == 'main' }}" >> $GITHUB_ENV | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
with: | |
fetch-depth: 0 | |
- name: ⎔ Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Install the packages | |
run: npm ci --legacy-peer-deps | |
- name: Format release with Prettier | |
run: npm run format | |
- name: Build the dist code | |
run: npm run build | |
- name: Create Release Pull Request or Publish (for latest release) | |
if: env.latest == 'true' | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
version: npm run version | |
publish: npm run changeset publish | |
# we use the commit message in next release workflow file. This avoid a next release when an actual release is happening | |
commit: '[ci] release ${{ env.latestBranch }}' | |
title: '[ci] release ${{ env.latestBranch }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
compile: | |
needs: changelog | |
# Only compile templates if a release was published, and we're on the "latest" release branch | |
if: needs.changelog.outputs.published == 'true' && needs.changelog.outputs.latest == 'true' | |
runs-on: ubuntu-latest | |
name: Compile the typescript templates and push them to main | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
- name: Install the packages | |
run: npm install --frozen-lockfile --ignore-engines | |
- name: Build the dist code | |
run: npm run build | |
- name: Compile skeleton | |
run: | | |
node scripts/compile-template-for-dist.mjs skeleton | |
(cd templates/skeleton-js && npm i --package-lock-only --workspaces false) | |
(cd templates/skeleton-ts && npm i --package-lock-only --workspaces false) | |
- name: Update templates in the dist branch | |
run: | | |
git add . | |
git status | |
git config user.email "[email protected]" | |
git config user.name "Hydrogen Bot" | |
git show-ref | |
git commit -m "Update templates for dist" | |
git push origin HEAD:dist --force | |
slack_announcement: | |
needs: changelog | |
# Only announce if a release was published, and we're on the "latest" release branch | |
if: needs.changelog.outputs.published == 'true' && needs.changelog.outputs.latest == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
# Extract the Hydrogen version from published packages | |
- name: Extract Hydrogen version | |
id: extract_version | |
run: | | |
PACKAGES='${{ needs.changelog.outputs.publishedPackages }}' | |
HYDROGEN_VERSION=$(echo $PACKAGES | jq -r '.[] | select(.name == "@shopify/hydrogen") | .version') | |
echo "HYDROGEN_VERSION=$HYDROGEN_VERSION" >> $GITHUB_ENV | |
- name: Post release announcement on Partner Slack | |
# Only post if a Hydrogen version was included in the release | |
if: env.HYDROGEN_VERSION != '' | |
id: slack | |
uses: fjogeleit/http-request-action@v1 | |
with: | |
url: ${{ secrets.SLACK_NOTIFICATION_URL }} | |
method: 'POST' | |
customHeaders: '{"Content-Type": "application/json"}' | |
data: "{\"version\": \"${{ env.HYDROGEN_VERSION }}\"}" | |
# sync_latest: | |
# needs: changelog | |
# # Only update package-lock.json if a release was published, and we're on the "latest" release branch | |
# if: needs.changelog.outputs.published == 'true' && needs.changelog.outputs.latest == 'true' | |
# runs-on: ubuntu-latest | |
# name: Sync latest to version branch | |
# steps: | |
# - name: Checkout the code | |
# uses: actions/checkout@v4 | |
# - name: Update package-lock.json | |
# run: npm install --package-lock-only --ignore-engines | |
# TODO: Figure out how to push to protected branch | |
# - name: Push commit to main branch | |
# run: | | |
# git add . | |
# git status | |
# git config user.email "[email protected]" | |
# git config user.name "Hydrogen Bot" | |
# git show-ref | |
# git commit -m "[ci] Update package-lock.json" | |
# git push origin HEAD:main | |
# - name: Sync latest to version branch | |
# run: | | |
# git config user.email "[email protected]" | |
# git config user.name "Hydrogen Bot" | |
# git show-ref | |
# git commit -m "[ci] release ${{ needs.changelog.outputs.latestBranch }}" | |
# git push origin main:${{ needs.changelog.outputs.latestBranch }} --force |