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(repo): refactor publish.yml for PR releases #26550

Merged
merged 2 commits into from
Jun 14, 2024
Merged

Conversation

JamesHenry
Copy link
Collaborator

Redo of #26509, with more guards for unexpected missing/relative values within full releases in GitHub Actions.


Refactors our publish workflow to support PR releases, in addition to our previous triggers.

Tests:





  • Real PR release created here:
Release details 📑
Published version 0.0.0-pr-26515-856ef7f
Triggered by @JamesHenry
Branch JamesHenry-patch-1
Commit 856ef7f
Workflow run 9497298216

Copy link

vercel bot commented Jun 14, 2024

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

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jun 14, 2024 10:16am

@JamesHenry JamesHenry changed the title Pr release redo chore(repo): refactor publish.yml for PR releases Jun 14, 2024
module.exports = async ({ github, context, core }) => {
const data = await getPublishResolveData({ github, context });

// Ensure that certain outputs are always set
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added checks for missing data

*
* Source: https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
*/
const refName = process.env.GITHUB_REF_NAME;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Refactored to use the env var now that we know the JS copy of github does not match the GitHub Actions shell one, and explicitly checking for it not being set. I believe it should be able for all triggers, but we can relax this if it is not because we will be covered by the check above before setting the outputs

@@ -241,7 +239,16 @@ function parseArgs() {
description:
'The version to publish. This does not need to be passed and can be inferred.',
default: 'minor',
coerce: (version) => {
coerce: (version: string) => {
const isGithubActions = !!process.env.GITHUB_ACTIONS;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added extra safety check for the combination that bit us yesterday - if in the context of GitHub Actions we should always be receiving an explicit version number, not a relative keyword (our default of minor)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This file is the same as yesterday's merge

@FrozenPandaz FrozenPandaz merged commit 42749b8 into master Jun 14, 2024
6 checks passed
@FrozenPandaz FrozenPandaz deleted the pr-release-redo branch June 14, 2024 11:07
FrozenPandaz pushed a commit that referenced this pull request Jun 21, 2024
Redo of #26509, with more guards for unexpected missing/relative values
within full releases in GitHub Actions.

---

Refactors our publish workflow to support PR releases, in addition to
our previous triggers.

**Tests:**

---

- Example of failure on non-PR release (comment skipped):
https://github.com/nrwl/nx/actions/runs/9480869812

---

- Example of failure on PR release (comment created on PR):
  - https://github.com/nrwl/nx/actions/runs/9480852880
  - #26515 (comment)

---

- Example of dry-run of full release (`workflow_dispatch` with no PR
number provided): https://github.com/nrwl/nx/actions/runs/9497871483

---

- Real PR release created here:

| Release details | 📑 |
  | ------------- | ------------- |
| **Published version** |
[0.0.0-pr-26515-856ef7f](https://www.npmjs.com/package/nx/v/0.0.0-pr-26515-856ef7f)
|
  | **Triggered by** | @JamesHenry |
| **Branch** |
[JamesHenry-patch-1](https://github.com/nrwl/nx/tree/JamesHenry-patch-1)
|
| **Commit** |
[856ef7f](856ef7f)
|
| **Workflow run** |
[9497298216](https://github.com/nrwl/nx/actions/runs/9497298216) |

---------

Co-authored-by: Katerina Skroumpelou <sk.katherine@gmail.com>
(cherry picked from commit 42749b8)
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants