diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml deleted file mode 100644 index 66709e59eb..0000000000 --- a/.github/workflows/changesets.yml +++ /dev/null @@ -1,163 +0,0 @@ -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 }} - 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-01" >> $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: Compile hello-world - run: | - node scripts/compile-template-for-dist.mjs hello-world - - - 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 - - # 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 "hydrogen@shopify.com" - # 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 "hydrogen@shopify.com" - # 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 - - 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@v4 - - - 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 "packageJson=$content" >> "$GITHUB_OUTPUT" - - 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/releases/tag/@shopify/hydrogen@${{ env.HYDROGEN_VERSION }}" diff --git a/.github/workflows/next-release.yml b/.github/workflows/next-release.yml deleted file mode 100644 index 757e8c387c..0000000000 --- a/.github/workflows/next-release.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: ⏭️ Next Release - -on: - push: - branches: - - main - -jobs: - next-release: - name: ⏭️ Next Release - runs-on: ubuntu-latest - # don't run if a commit message with [ci] release is present. The release workflow will do the release - if: github.repository_owner == 'shopify' && !startsWith(github.event.head_commit.message, '[ci] release') - outputs: - NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }} - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - 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 - - - name: Format release with Prettier - run: npm run format - - - name: 🕵️ Check for changes - id: version - run: | - # get latest commit sha - SHA=$(git rev-parse HEAD) - # get first 7 characters of sha - SHORT_SHA=${SHA::7} - NEXT_VERSION=next-${SHORT_SHA} - # set output so it can be used in other jobs - echo "NEXT_VERSION=${NEXT_VERSION}" >> $GITHUB_OUTPUT - - - name: 🏗 Build CLI - if: steps.version.outputs.NEXT_VERSION - run: npm run build - - - name: ⤴️ Update version - if: steps.version.outputs.NEXT_VERSION - run: | - git config user.email "hydrogen@shopify.com" - git config user.name "Hydrogen Bot" - git checkout -B next/${{ steps.version.outputs.NEXT_VERSION }} - # using changeset snapshot releases, this sets the version to 0.0.0-{tag}-DATETIMESTAMP where tag=next-SHORT_SHA - # as an example this results in a next release as following 0.0.0-next-1686a75-20230313113149 with a next tag - npm run version:next - npm run changeset -- version --snapshot ${{steps.version.outputs.NEXT_VERSION}} - npm run version:post - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: 🏗 Build - if: steps.version.outputs.NEXT_VERSION - run: npm run build - - - name: 🔐 Setup npm auth - if: steps.version.outputs.NEXT_VERSION - run: | - echo "registry=https://registry.npmjs.org" >> ~/.npmrc - echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: 🚀 Publish - if: steps.version.outputs.NEXT_VERSION - run: npm run changeset -- publish --tag next