-
Notifications
You must be signed in to change notification settings - Fork 245
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: add release workflow #805
Changes from all commits
e6b8ff0
d183591
67f3cf7
b0d63b0
0c95810
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Ship js Manual Prepare | ||
on: | ||
issue_comment: | ||
types: [created] | ||
jobs: | ||
manual_prepare: | ||
if: | | ||
github.event_name == 'issue_comment' && | ||
(github.event.comment.author_association == 'member' || github.event.comment.author_association == 'owner') && | ||
startsWith(github.event.comment.body, '@shipjs prepare') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: master | ||
- uses: actions/setup-node@v1 | ||
- run: | | ||
if [ -f "yarn.lock" ]; then | ||
yarn install | ||
else | ||
npm install | ||
fi | ||
- run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
- run: npm run release -- --yes --no-browse | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} | ||
|
||
create_done_comment: | ||
if: success() | ||
needs: manual_prepare | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: "@${{github.actor}} `shipjs prepare` done" | ||
}) | ||
|
||
create_fail_comment: | ||
if: cancelled() || failure() | ||
needs: manual_prepare | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/github-script@v3 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: "@${{github.actor}} `shipjs prepare` fail" | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Ship js Schedule Prepare | ||
on: | ||
schedule: | ||
- cron: '0 9 * * 2' | ||
jobs: | ||
schedule_prepare: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: master | ||
- uses: actions/setup-node@v1 | ||
- run: | | ||
if [ -f "yarn.lock" ]; then | ||
yarn install | ||
else | ||
npm install | ||
fi | ||
- run: | | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --global user.name "github-actions[bot]" | ||
- run: npm run release -- --yes --no-browse | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_INCOMING_HOOK: ${{ secrets.SLACK_INCOMING_HOOK }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Ship js trigger | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
jobs: | ||
build: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'releases/v') | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
ref: master | ||
- uses: actions/setup-node@v1 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: | | ||
if [ -f "yarn.lock" ]; then | ||
yarn install | ||
else | ||
npm install | ||
fi | ||
- run: npx shipjs trigger | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
publishCommand: ({ defaultCommand, tag }) => | ||
`${defaultCommand} --access public --tag ${tag}`, | ||
Comment on lines
+2
to
+3
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will run a command like |
||
shouldPrepare: ({ releaseType, commitNumbersPerType }) => { | ||
const { fix = 0 } = commitNumbersPerType | ||
if (releaseType === 'patch' && fix === 0) { | ||
return false | ||
} | ||
return true | ||
} | ||
Comment on lines
+4
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's going to be a patch release, but doesn't include "fix" commits, then it will skip the release. Think about having only "chore" commits. You probably don't want to release it. This is especially useful when you have scheduled releases. |
||
} |
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.
You can change the cron expression if there's any preferred time/date.
Currently it's every Tuesday 02:00 UTC.