-
Notifications
You must be signed in to change notification settings - Fork 46
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
[ci] Add release automation scripts #141
Conversation
cache: 'yarn' | ||
- name: Build latest (main) version | ||
if: github.ref == 'refs/heads/main' | ||
run: yarn version --no-git-tag-version --new-version 0.0.0-main-${GITHUB_SHA} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, if this is a push to the main branch, this will update the version in package.json
to be a prerelease with the latest commit SHA.
done | ||
env: | ||
TAG: ${{ github.ref == 'refs/heads/main' && '--tag=main' || ((contains(github.ref_name, '-rc.') && '--tag=dev') || '' )}} | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then finally the package gets published.
So the awkward bit is now the version in
Given this, I'm going to change things so that we don't update |
if: github.ref == 'refs/heads/main' | ||
run: yarn version --no-git-tag-version --new-version 0.0.0-main-${GITHUB_SHA} | ||
- name: Check release version matches tag | ||
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if this is a push to a tag, then check that the tag matches the value of the version in package.json
.
@captbaritone Alright, done, left a few TODOs for you in the PR description. |
Your reasoning looks sound! Let me try to setup the token before merging this. |
I've configured the GitHub secret to work. I'll merge this now and we can see how it goes. |
@alloy Looks like the publish failed. I'm not sure why. Output from the run:
You can see that it did see a (redacted) Any ideas? |
Any updates on this? |
The reason you are getting this error is because you are using auth token that requires two factor auth. When creating tokens, there is an explicit option to create a token for automations that does not have that restriction. |
Oh and you need to use the legacy version of the token. |
Ported from https://github.com/facebook/relay/blob/main/.github/workflows/ci.yml
main
push, this will publish a prerelease package that follows the format0.0.0-main-SHA
TODO:
NPM_TOKEN
secret