|
| 1 | +name: Deploy |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + # manual trigger |
| 7 | + workflow_dispatch: |
| 8 | +jobs: |
| 9 | + # Wait for up to a minute for previous run to complete, abort if not done by then |
| 10 | + pre-run: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + timeout-minutes: 15 |
| 13 | + steps: |
| 14 | + - name: 'Block Concurrent Executions' |
| 15 | + uses: softprops/turnstyle@v1 |
| 16 | + with: |
| 17 | + poll-interval-seconds: 10 |
| 18 | + env: |
| 19 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 20 | + |
| 21 | + bump_version: |
| 22 | + name: Bump Version |
| 23 | + needs: pre-run |
| 24 | + runs-on: ubuntu-latest |
| 25 | + outputs: |
| 26 | + new_tag: ${{ steps.github_tag_action.outputs.new_tag }} |
| 27 | + changelog: ${{ steps.github_tag_action.outputs.changelog }} |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v1 |
| 31 | + |
| 32 | + - name: Bump version and push tag |
| 33 | + id: github_tag_action |
| 34 | + uses: mathieudutour/[email protected] |
| 35 | + with: |
| 36 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + release_branches: main |
| 38 | + |
| 39 | + create_release: |
| 40 | + name: Create Release |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: bump_version |
| 43 | + if: ${{ needs.bump_version.outputs.new_tag != null }} |
| 44 | + steps: |
| 45 | + - name: Checkout 🛎️ |
| 46 | + |
| 47 | + |
| 48 | + - name: Setup Node |
| 49 | + uses: actions/setup-node@v1 |
| 50 | + with: |
| 51 | + node-version: '14.17.0' |
| 52 | + |
| 53 | + - name: Install yarn |
| 54 | + run: npm install --global yarn |
| 55 | + |
| 56 | + - name: Cache dependencies |
| 57 | + uses: actions/cache@v1 |
| 58 | + with: |
| 59 | + path: ~/.npm |
| 60 | + key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} |
| 61 | + restore-keys: | |
| 62 | + ${{ runner.os }}-node- |
| 63 | +
|
| 64 | + - name: Install Dependencies |
| 65 | + run: | |
| 66 | + yarn install --frozen-lockfile |
| 67 | +
|
| 68 | + - name: Build |
| 69 | + run: | |
| 70 | + yarn run build |
| 71 | +
|
| 72 | + - name: Deploy 🚀 |
| 73 | + |
| 74 | + with: |
| 75 | + branch: gh-pages # The branch the action should deploy to. |
| 76 | + folder: build # The folder the action should deploy. |
| 77 | + |
| 78 | + - name: Create GitHub Release |
| 79 | + id: create_release |
| 80 | + |
| 81 | + env: |
| 82 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + with: |
| 84 | + tag_name: ${{ needs.bump_version.outputs.new_tag }} |
| 85 | + release_name: Release ${{ needs.bump_version.outputs.new_tag }} |
| 86 | + body: | |
| 87 | + New version ${{ needs.bump_version.outputs.new_tag }} |
0 commit comments