Use root project build tools version if present #668
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Transpile TS and Update package.json | |
on: | |
pull_request: | |
branches: [master] | |
jobs: | |
transpile-ts: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token. | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo. | |
ref: ${{ github.event.pull_request.head.sha }} # checks out the branch being merged into `master` | |
- name: Install dependencies | |
run: | | |
npm i @types/[email protected] --save-dev | |
npm i [email protected] | |
- name: Node setup | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
cache: 'npm' | |
- name: Build JavaScript files | |
run: | # Change line to your build script command. | |
npm run start | |
- name: Force add JS files to override .gitignore | |
run: git add --force ./lib # <-- Change this to your build path. | |
- name: Commit files | |
run: | # Change last line to your preferred commit message (I like `chore: build js files`). | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "Updating JS files" || echo "No commit needed. JS files are already up-to-date" | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.event.pull_request.head.ref }} # pushes the commit to the branch being merged into `master` | |
package-json-update: | |
needs: transpile-ts | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token. | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo. | |
ref: ${{ github.event.pull_request.head.sha }} # checks out the branch being merged into `master` | |
- name: Node setup | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- name: Get Latest package.json | |
run: | | |
git pull origin ${{ github.head_ref }} | |
git checkout origin/master package.json | |
- name: Update package.json | |
run: node scripts/update_version.js | |
- name: Commit files | |
run: | # Change last line to your preferred commit message (I like `chore: build js files`). | |
git add package.json | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "Updating package version" || echo "No commit needed. Package.json is already up-to-date" | |
- name: Push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.event.pull_request.head.ref }} # pushes the commit to the branch being merged into `master` |