|
| 1 | +# This is a workflow that runs on PR builds. |
| 2 | + |
| 3 | +name: "PR build" |
| 4 | + |
| 5 | +# Controls when the action will run. |
| 6 | +on: |
| 7 | + # Triggers the workflow on pull request events for the master branch |
| 8 | + pull_request: |
| 9 | + branches: [master] |
| 10 | + |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 15 | +jobs: |
| 16 | + # This workflow contains a single job called "build" |
| 17 | + build: |
| 18 | + # The type of runner that the job will run on |
| 19 | + runs-on: ubuntu-latest |
| 20 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 21 | + steps: |
| 22 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v2 |
| 25 | + |
| 26 | + # Sets up Node and an .npmrc file. This is the official Github supported way to set up node. |
| 27 | + - uses: actions/setup-node@v2 |
| 28 | + with: |
| 29 | + node-version: "12" |
| 30 | + registry-url: "https://registry.npmjs.org" |
| 31 | + cache: "yarn" |
| 32 | + always-auth: "true" |
| 33 | + |
| 34 | + - name: Install packages |
| 35 | + run: yarn --frozen-lockfile |
| 36 | + |
| 37 | + - name: Set Firefox Env Variable |
| 38 | + run: export FIREFOX_BIN=$(which firefox) |
| 39 | + |
| 40 | + - name: Set Chrome Env Variable |
| 41 | + run: export CHROME_BIN=$(which chrome) |
| 42 | + |
| 43 | + - name: Print environment variables |
| 44 | + run: echo "CHROME_BIN = $CHROME_BIN FIREFOX_BIN = $FIREFOX_BIN" |
| 45 | + |
| 46 | + - name: CI BUILD + UT |
| 47 | + run: yarn ci-test |
| 48 | + |
| 49 | + - name: Check whether version was bumped in PR |
| 50 | + id: actions_project_version_check |
| 51 | + uses: "thomastay/[email protected]" |
| 52 | + with: |
| 53 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 54 | + file-to-check: package.json |
| 55 | + fail-build-if-not-bumped: false |
| 56 | + target-branch: master |
| 57 | + |
| 58 | + - name: "Automated Version Bump" |
| 59 | + uses: "phips28/gh-action-bump-version@master" |
| 60 | + if: ${{ steps.actions_project_version_check.outputs.semver == 'no-update' }} |
| 61 | + with: |
| 62 | + tag-prefix: "v" |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + |
| 66 | + - name: Final check for version bump |
| 67 | + uses: "thomastay/[email protected]" |
| 68 | + with: |
| 69 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + file-to-check: package.json |
| 71 | + fail-build-if-not-bumped: true |
| 72 | + target-branch: master |
0 commit comments