Skip to content

[ci] release v1.x-2022-07 (#2534) #994

[ci] release v1.x-2022-07 (#2534)

[ci] release v1.x-2022-07 (#2534) #994

Workflow file for this run

name: Changesets
on:
push:
branches:
- 'v[0-9].x-[0-9]+-[0-9]+'
- 'v[0-9].[0-9].x-[0-9]+-[0-9]+'
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 }}
latest: ${{ steps.flags.outputs.latest }}
steps:
- name: Flags
id: flags
run: |
# IMPORTANT: Update this variable whenever we move to a new major version:
latest_branch=v1.x-2022-07
echo "::set-output name=latest::${{ github.ref_name == 'v1.x-2022-07' }}"
- name: Checkout the code
uses: actions/checkout@v2
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Install the packages
run: yarn install --frozen-lockfile --ignore-engines
- name: Format release with Prettier
run: yarn format
- name: Create Release Pull Request or Publish (for latest release)
if: steps.flags.outputs.latest == 'true'
id: changesets
uses: changesets/action@v1
with:
version: yarn run version
publish: yarn changeset publish --tag h1
commit: '[ci] release ${{ github.ref_name }}'
title: '[ci] release ${{ github.ref_name }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Release Pull Request or Publish (for legacy patch release)
if: steps.flags.outputs.latest != 'true'
id: changesets_legacy
uses: changesets/action@v1
with:
version: yarn run version
publish: yarn 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
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@v2
- name: Install the packages
run: yarn install --frozen-lockfile --ignore-engines --network-timeout 36000
- name: Compile hello-world
run: |
node scripts/compile-template-for-dist.mjs hello-world
- name: Compile demo-store
run: |
node scripts/compile-template-for-dist.mjs demo-store
- name: Update templates in the dist 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 templates for dist"
git push origin HEAD:dist --force
discord_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:
- name: Check out the code
uses: actions/checkout@v2
- name: Read Hydrogen version from package.json
id: read_package_json
working-directory: ./packages/hydrogen
run: |
content=`cat ./package.json`
# the following lines are required for multi line json
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
# end of handling multi line json
echo "::set-output name=packageJson::$content"
- run: |
echo "HYDROGEN_VERSION=${{fromJSON(steps.read_package_json.outputs.packageJson).version}}" >> $GITHUB_ENV
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: Shopify Devs
DISCORD_AVATAR: https://cdn.discordapp.com/avatars/905537246990590012/0f6a687b93ef3f81a036c817fb02ccbf.webp
uses: Ilshidur/action-discord@08d9328877d6954120eef2b07abbc79249bb6210
with:
args: "Hydrogen ${{ env.HYDROGEN_VERSION }} has been released.\nhttps://github.com/Shopify/hydrogen-v1/releases/tag/@shopify/hydrogen@${{ env.HYDROGEN_VERSION }}"