Skip to content

Conversation

@JoseLion
Copy link
Contributor

This PR sets up semantic-release and adds a workflow to GitHub Actions to release a package to NPM whenever changes are pushed to the release branch

@JoseLion JoseLion self-assigned this Aug 19, 2022
@JoseLion
Copy link
Contributor Author

PS: We need to push all workflow files to the main branch to be able to test the complete workflow in a dry run. Unfortunately, this is how GitHub Actions works:
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run

@JoseLion JoseLion force-pushed the chore/setup-semantic-release branch from 6154bc8 to 6db59bd Compare August 23, 2022 22:53
@JoseLion
Copy link
Contributor Author

Result of testing the release.yml action in dry-mode:
https://github.com/stackbuilders/assertive-ts/runs/7984380826?check_suite_focus=true

@JoseLion JoseLion force-pushed the chore/setup-semantic-release branch from 6db59bd to 6852bfc Compare August 23, 2022 22:58
@JoseLion JoseLion force-pushed the chore/setup-semantic-release branch from 6852bfc to 27abf80 Compare August 24, 2022 16:01
steps:
- name: Deploy to GitHub Pages
- uses: actions/deploy-pages@v1
id: deployment
Copy link
Member

Choose a reason for hiding this comment

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

@JoseLion since you are not referencing this step anywhere, I think you should be able to get rid of the id

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I'll give it a try! I took this from GitHub's auto-generated action for deploying GH Pages, so I'm not sure why they added the id to that final step 🤔

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 worked perfectly fine! Thank you @sestrella!! 🙂

branch: release
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

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

@JoseLion what do you think about renaming GH_TOKEN secret to GITHUB_TOKEN just for the sake of consistency?

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 tried that, but unfortunately, GitHub does not allow to create secrets starting with GITHUB_. I think they reserve that prefix for their own use 🙂

Copy link
Member

Choose a reason for hiding this comment

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

@JoseLion oh! I realized this is a secret declared by us, most likely it is bound to your GH user account. I think it would be better to use the token already provided by the execution context, so try getting rid of GH_TOKEN and change this reference to secrets.GITHUB_TOKEN GH actions create one token by default

image

Copy link
Member

Choose a reason for hiding this comment

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

If you face some issues with permissions using this token try assigning a different permission set

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, the problem was around permission. Awesome, I'll do that instead 👍🏼

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to be working on dry-mode. I'll keep the GH_TOKEN secret around just in case until our first release. Thanks for the help @sestrella! 🎉

Copy link
Member

@sestrella sestrella left a comment

Choose a reason for hiding this comment

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

@JoseLion overall looks good, I just left some minor comments

@JoseLion JoseLion temporarily deployed to github-pages August 24, 2022 16:45 Inactive
@JoseLion JoseLion force-pushed the chore/setup-semantic-release branch from e76d369 to da162f1 Compare August 24, 2022 16:47
@JoseLion JoseLion force-pushed the chore/setup-semantic-release branch from 6541f08 to 0bdad85 Compare August 24, 2022 17:04
@JoseLion JoseLion merged commit 30e979b into main Aug 24, 2022
@JoseLion JoseLion deleted the chore/setup-semantic-release branch August 24, 2022 17:27
@github-actions
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants