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: separate workflows for prs releases and tags #3276

Merged
merged 18 commits into from
Aug 14, 2024

Conversation

jenniferarnesen
Copy link
Collaborator

@jenniferarnesen jenniferarnesen commented Jul 4, 2024

PR workflow: verify-pr.yml
This workflow triggers on pull request actions only. It verifies that the PR code passes build, lint, test, and e2e.

Release workflow: release.yml
This workflow only runs on pushes to the master branch since this is the only release branch. Every release involves 2 commits to master:

  1. squash merging the PR
  2. the release workflow pushes a new commit with version change in package.json and CHANGELOG.md, e.g. the [skip release] commit

The release workflow triggers for both pushes to master listed above. But we only want the jobs to run for the first push. Therefore all jobs (e.g. build, lint, test, e2e, release, report) check that the commit is not a "[skip release]". In the case of the second commit ([skip release]) the workflow will therefore complete successfully without running any jobs.

The semantic-release workflow steps are found in .releaserc. Previously @dhis2/action-semantic-release was used but this was overkill for our needs and difficult to make changes to. Therefore, we created our own semantic-release steps in .releaserc:

  1. commit-analyzer: Determines the next app version
  2. release-notes-generator: Generates the new release notes
  3. changelog: Updates CHANGELOG.md with the generated release notes
  4. npm: Updates package.json with the new version number. Does not publish to npm since private: true in package.json
  5. exec: Runs yarn build which updates all version number references in the bundle
  6. git: creates commit number "2" (mentioned above) with just CHANGELOG.md and package.json and pushes it to the remote
  7. github: pushes the bundle to the github repo as a new release and adds a tag

After semantic-release is complete, the bundle is then published to AppHub so that it is actually available to all users. Because of the addition of the exec yarn build step, all references to the version in the bundle should be the same, thus fixing the annoying bug where the old version displays in the instance after installing the later version.

If any point in the release fails, then a failure message is sent to slack. If the release step succeeds, then a success message is posted to slack that includes the new version number and the release notes.

Publish to d2-ci: publish-to-d2-ci.yml
This workflow publishes the build to d2-ci in the following cases:

  1. The [skip release] commit on master
  2. Git tags
    Fail message is sent to slack if the publish failed

@dhis2-bot
Copy link
Contributor

dhis2-bot commented Jul 4, 2024

🚀 Deployed on https://pr-3276--dhis2-maps.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify July 4, 2024 10:12 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 4, 2024 10:30 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 4, 2024 10:43 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 4, 2024 10:53 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 9, 2024 12:52 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 9, 2024 13:04 Inactive
Copy link
Contributor

@HendrikThePendric HendrikThePendric left a comment

Choose a reason for hiding this comment

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

Great work @jenniferarnesen. I've left a few comments we should discuss when you get back.

Perhaps something we could also discuss then, is how we can share this across our analytics repos. Or perhaps before we get to that, discuss if we want to actually do this. As a team we have:

  • 4 react apps
  • 2 ExtJS apps
  • 1 NPM library

I guess sharing the workflow config could make sense for these 4 react-apps. But both the maps-app and dashboards-app have some special requirements (?). Just copy-pasting things across repos might actually be a more suitable solution in this case, since it offers a much higher level of flexibility and prevents us from having to maintain this shared config.

.github/workflows/publish-d2-ci.yml Show resolved Hide resolved
.github/workflows/publish-d2-ci.yml Outdated Show resolved Hide resolved
.github/workflows/publish-d2-ci.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Show resolved Hide resolved
.releaserc Outdated Show resolved Hide resolved
@dhis2-bot dhis2-bot temporarily deployed to netlify July 31, 2024 13:23 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 13, 2024 09:41 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 13, 2024 09:58 Inactive
@jenniferarnesen
Copy link
Collaborator Author

Great work @jenniferarnesen. I've left a few comments we should discuss when you get back.

Perhaps something we could also discuss then, is how we can share this across our analytics repos. Or perhaps before we get to that, discuss if we want to actually do this. As a team we have:

  • 4 react apps
  • 2 ExtJS apps
  • 1 NPM library

I guess sharing the workflow config could make sense for these 4 react-apps. But both the maps-app and dashboards-app have some special requirements (?). Just copy-pasting things across repos might actually be a more suitable solution in this case, since it offers a much higher level of flexibility and prevents us from having to maintain this shared config.

My approach is to get this merged in maps-app, and give it a few release cycles to make sure it works the way we want it to. Then, we can generalize it, make shared workflows, etc and move our apps to it.

@dhis2-bot dhis2-bot temporarily deployed to netlify August 13, 2024 10:34 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 13, 2024 10:49 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 13, 2024 11:03 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 14, 2024 08:05 Inactive
Copy link
Contributor

@HendrikThePendric HendrikThePendric left a comment

Choose a reason for hiding this comment

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

I've re-reviewed, but would still like to resolve this conversation before merging.

.github/workflows/release.yml Show resolved Hide resolved
@jenniferarnesen jenniferarnesen merged commit 9efdff5 into master Aug 14, 2024
18 checks passed
@jenniferarnesen jenniferarnesen deleted the chore/new-gh-workflows branch August 14, 2024 08:59
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.6.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

3 participants