From 4a476e90fb72c157b3919b83480a37de7e78080e Mon Sep 17 00:00:00 2001 From: Dominic Cupidon <83605527+dcupidon@users.noreply.github.com> Date: Fri, 19 Nov 2021 11:04:22 -0800 Subject: [PATCH] New Build Process (#420) * Update build process to use one branch system * Update CONTRIBUTING.md to use master branch not dev - Also mention JS files must be manually updated when PR from fork * Added comments to the build process * Updating JS files Co-authored-by: akwanpdf Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .github/workflows/jsBuilder.yml | 12 ++++++------ CONTRIBUTING.md | 10 ++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/jsBuilder.yml b/.github/workflows/jsBuilder.yml index 8e9c5f97a..0130e1ec9 100644 --- a/.github/workflows/jsBuilder.yml +++ b/.github/workflows/jsBuilder.yml @@ -1,8 +1,8 @@ name: Transpile TS on: - push: - branches: [dev] # <-- Change this to the primary branch (for example, "dev" if you want all changes to `dev` to be watched). + pull_request: + branches: [master] jobs: build: @@ -13,6 +13,7 @@ jobs: 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: | @@ -25,7 +26,7 @@ jobs: cache: 'npm' - name: Build JavaScript files - run: | # Change last line to your build script command #. + run: | # Change line to your build script command. npm run start - name: Force add JS files to override .gitignore @@ -35,11 +36,10 @@ jobs: 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" -a + git commit -m "Updating JS files" -a || echo "No commit needed. JS files are already up-to-date" - name: Push changes uses: ad-m/github-push-action@v0.6.0 with: - force: true github_token: ${{ secrets.GITHUB_TOKEN }} - branch: master # <-- Change this to the branch where you want builds to be (for example, "master" if you want changes to the primary branch to be applied to `master`). \ No newline at end of file + branch: ${{ github.event.pull_request.head.ref }} # pushes the commit to the branch being merged into `master` \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21adf0404..57a7b4648 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,10 +8,12 @@ ## Pull requests 1. Fork the repository. -2. Create a branch from `dev`. +2. Create a branch from `master`. 3. Update the source code (in `*.ts` files). 4. Commit and push the changes with descriptive messages. -5. Create a pull request to `dev`. +4. Create a pull request to `master`. -\* Please note that all pull requests should be tied to an issue, and all but the most trivial pull requests should be discussed beforehand. -\*\* Changes made to `dev` will automatically be applied to `master`. For more detailed information on developing post-TypeScript migration, see the [wiki](https://github.com/PDFTron/pdftron-react-native/wiki). \ No newline at end of file +Please note: +- All pull requests should be tied to an issue, and all but the most trivial pull requests should be discussed beforehand. +- Every PR needs 1 approving review to be merged into `master` (unless you are an administrator of the repo). +- When PRs are made from a fork, the GitHub Actions script that updates and commits JS files will not succeed due to safety reasons. Instead, the JS files will have to be updated manually. \ No newline at end of file