Skip to content

Commit

Permalink
switch changeset to main branch (#1259)
Browse files Browse the repository at this point in the history
  • Loading branch information
wizardlyhel committed Aug 23, 2023
1 parent 06516ee commit 6e19fa6
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "2023-07",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["hello-world", "skeleton"],
"privatePackages": {"version": true, "tag": true}
Expand Down
56 changes: 38 additions & 18 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Changesets
on:
push:
branches:
- '[0-9]+-[0-9]+'
- main

concurrency:
group: changeset-${{ github.head_ref }}
Expand All @@ -17,12 +17,14 @@ jobs:
outputs:
published: ${{ steps.changesets.outputs.published }}
latest: ${{ env.latest }}
latestBranch: ${{ env.latestBranch }}
steps:
- name: Flags
id: flags
run: |
# IMPORTANT: Update this variable whenever we move to a new major version:
echo "latest=${{ github.ref_name == '2023-07' }}" >> $GITHUB_ENV
# IMPORTANT: Update this latestBranch whenever we move to a new major version:
echo "latestBranch=2023-07" >> $GITHUB_ENV
echo "latest=${{ github.ref_name == 'main' }}" >> $GITHUB_ENV
- name: Checkout the code
uses: actions/checkout@v3
Expand Down Expand Up @@ -54,25 +56,12 @@ jobs:
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 ${{ github.ref_name }}'
title: '[ci] release ${{ github.ref_name }}'
commit: '[ci] release ${{ env.latestBranch }}'
title: '[ci] release ${{ env.latestBranch }}'
env:
GITHUB_TOKEN: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

# - name: Create Release Pull Request or Publish (for legacy patch release)
# if: env.latest != 'true'
# id: changesets_legacy
# uses: changesets/action@v1
# with:
# version: npm run version
# publish: npm run changeset publish --tag legacy
# commit: '[ci] release ${{ github.ref_name }}'
# title: '[ci] release ${{ github.ref_name }}'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_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
Expand Down Expand Up @@ -107,6 +96,37 @@ jobs:
git commit -m "Update templates for dist"
git push origin HEAD:dist --force
update_lock_and_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: Update package-lock.json
steps:
- name: Checkout the code
uses: actions/checkout@v3

- name: Update package-lock.json
run: npm install --package-lock-only --ignore-engines

- name: Push commit to main branch
run: |
git add .
git status
git config user.email "hydrogen@shopify.com"
git config user.name "Hydrogen Bot"
git show-ref
git commit -m "Update package-lock.json"
git push origin HEAD:main
- name: Sync latest to version branch
run: |
git config user.email "hydrogen@shopify.com"
git config user.name "Hydrogen Bot"
git show-ref
git commit -m "[ci] release ${{ needs.changelog.outputs.latestBranch }}"
git push origin HEAD:${{ needs.changelog.outputs.latestBranch }}
# discord_announcement:
# needs: changelog
# # Only announce if a release was published, and we're on the "latest" release branch
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/next-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: ⏭️ Next Release
on:
push:
branches:
# update to latest cal release to keep this action working
- 2023-07
- main

jobs:
next-release:
Expand Down

0 comments on commit 6e19fa6

Please sign in to comment.