Add parameter to control version script (#23)

* Add version script

* Run build

Co-authored-by: mitchellhamilton <mitchell@hamil.town>
This commit is contained in:
Luis Herranz
2020-04-15 06:56:31 +10:00
committed by GitHub
co-authored by mitchellhamilton
parent 65b9570cef
commit d6b65536ef
3 changed files with 67 additions and 19 deletions
+43 -3
View File
@@ -24,7 +24,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@master
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js 12.x
@@ -61,10 +61,9 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@master
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js 12.x
uses: actions/setup-node@master
with:
@@ -82,3 +81,44 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
### With version script
If you need to add additional logic to the version command, you can do so by using a version script.
If the version script is present, this action will run that script instead of `changeset version`, so please make sure that your script calls `changeset version` at some point. All the changes made by the script will be included in the PR.
```yml
name: Release
on:
push:
branches:
- master
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
with:
fetch-depth: 0
- name: Setup Node.js 12.x
uses: actions/setup-node@master
with:
node-version: 12.x
- name: Install Dependencies
run: yarn
- name: Create Release Pull Request
uses: changesets/action@master
with:
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
version: yarn version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```