Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: refactor release workflow #3678

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

nedsalk
Copy link
Contributor

@nedsalk nedsalk commented Feb 7, 2025

Summary

Note

Waiting for merge of #3639 to finalize this

This PR splits the release workflow into three workflows:

  • changesets-pr.yaml, which creates/updates the changesets PR,
  • release.yaml, which publishes releases when the changesets PR is merged,
  • publish-to-next.yaml, which publishes to the next in our GitHub npm registry on every merge to master

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@nedsalk nedsalk added the chore Issue is a chore label Feb 7, 2025
@nedsalk nedsalk self-assigned this Feb 7, 2025
Copy link

vercel bot commented Feb 7, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 3:52pm
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 3:52pm
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 7, 2025 3:52pm

@nedsalk nedsalk force-pushed the ns/chore/release-workflow branch from 880378b to 22bcc4e Compare February 7, 2025 14:30
@nedsalk nedsalk force-pushed the ns/chore/release-workflow branch from 22bcc4e to e2167f2 Compare February 7, 2025 14:31
# This is to avoid running the workflow when a release/* branch is created.
if: |
github.event.head_commit.message != 'ci(release): versioning packages and changesets' &&
github.event.before != '0000000000000000000000000000000000000000'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this if statement, as well as the one in the release.yaml file, in these workflows. I was specifically testing if the workflow will be started or not, and it works as is expected from the logic. If you want to test it yourself, you can create a new branch with a file with this workflow:

name: "You test"

on:
  push:

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
  changesets-pr:
    runs-on: ubuntu-latest
    permissions: write-all
    if: |
      github.event.head_commit.message != 'ci(release): versioning packages and changesets' &&
      github.event.before != '0000000000000000000000000000000000000000'

    steps:
      - name: Bump and Collect Versions
        run: echo ${{ toJson(github.event) }}

Commit the file and do the following steps:

  1. git push --set-upstream origin your_branch_name - the workflow won't run because of github.event.before != '0000000000000000000000000000000000000000'
  2. git commit --allow-empty -m "ci(release): versioning packages and changesets" && git push - the workflow won't run because the commit message equals 'ci(release): versioning packages and changesets'
  3. git commit --allow-empty -m "whatever" && git push - the workflow will run

The same holds for the release.yaml workflow, just point 2 will succeed and point 3 will fail.

if: github.event.before != '0000000000000000000000000000000000000000'
if: |
github.event.head_commit.message == 'ci(release): versioning packages and changesets' &&
github.event.before != '0000000000000000000000000000000000000000'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, because the workflow won't run at all except when the changesets PR gets merged, we won't be getting the manual approval requests in our notifications that were caused by environment: npm-deploy.

@nedsalk nedsalk marked this pull request as ready for review February 7, 2025 15:59
@nedsalk nedsalk changed the title chore: split release workflow into release and changesets PR chore: refactor release workflow Feb 7, 2025
Copy link
Contributor

github-actions bot commented Feb 7, 2025

Coverage Report:

Lines Branches Functions Statements
77.15%(+0%) 70.69%(+0%) 75.3%(+0%) 77.15%(+0%)
Changed Files:

Coverage values did not change👌.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decouple release workflow
1 participant