|
| 1 | +name: Deploy Bundle to Dev |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + |
| 7 | +jobs: |
| 8 | + build-release: |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + permissions: |
| 11 | + id-token: write |
| 12 | + contents: read |
| 13 | + actions: read |
| 14 | + environment: DEV |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + node: ["20.x"] |
| 18 | + os: [ubuntu-latest] |
| 19 | + env: |
| 20 | + CI: 1 |
| 21 | + HUSKY: 0 # disables husky hooks |
| 22 | + steps: |
| 23 | + - name: Checkout Repo |
| 24 | + uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + token: ${{ secrets.GH_SEMANTIC_RELEASE_PAT }} |
| 27 | + |
| 28 | + - name: Use Node ${{ matrix.node }} |
| 29 | + uses: actions/setup-node@v4 |
| 30 | + with: |
| 31 | + node-version: ${{ matrix.node }} |
| 32 | + # registry-url not needed - no npm publishing in dev workflow |
| 33 | + |
| 34 | + - name: Install Deps (with cache) |
| 35 | + uses: bahmutov/npm-install@v1 |
| 36 | + with: |
| 37 | + install-command: yarn --immutable --no-progress --ignore-scripts |
| 38 | + |
| 39 | + - name: Get New Version |
| 40 | + id: get-new-version |
| 41 | + uses: mathieudutour/github-tag-action@v5.2 |
| 42 | + with: |
| 43 | + dry_run: true |
| 44 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + |
| 46 | + - name: Bump Version |
| 47 | + run: make update-version NEW_VERSION=${{ steps.get-new-version.outputs.new_version }} |
| 48 | + |
| 49 | + - name: Build |
| 50 | + run: make build |
| 51 | + env: |
| 52 | + SKIP_INSTALL: 1 # install with cache was done already |
| 53 | + |
| 54 | + create-pre-release: |
| 55 | + runs-on: ubuntu-latest |
| 56 | + needs: |
| 57 | + - build-release |
| 58 | + strategy: |
| 59 | + matrix: |
| 60 | + node: ["20.x"] |
| 61 | + steps: |
| 62 | + - name: Version and Tag |
| 63 | + id: version-and-tag |
| 64 | + uses: mathieudutour/github-tag-action@v5.2 |
| 65 | + with: |
| 66 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 67 | + |
| 68 | + - name: Generate Release Notes |
| 69 | + id: release-notes |
| 70 | + uses: actions/github-script@v6 |
| 71 | + env: |
| 72 | + NEW_RELEASE_TAG: ${{ steps.version-and-tag.outputs.new_tag }} |
| 73 | + with: |
| 74 | + result-encoding: string |
| 75 | + script: | |
| 76 | + const { NEW_RELEASE_TAG } = process.env; |
| 77 | + const latestRelease = await github.rest.repos.getLatestRelease({ |
| 78 | + owner: context.repo.owner, |
| 79 | + repo: context.repo.repo, |
| 80 | + }); |
| 81 | + const releaseNotes = await github.rest.repos.generateReleaseNotes({ |
| 82 | + owner: context.repo.owner, |
| 83 | + repo: context.repo.repo, |
| 84 | + tag_name: NEW_RELEASE_TAG, |
| 85 | + previous_tag_name: latestRelease.data.tag_name, |
| 86 | + }); |
| 87 | + return releaseNotes.data.body; |
| 88 | +
|
| 89 | + - name: Create Pre-Release |
| 90 | + uses: softprops/action-gh-release@v1 |
| 91 | + with: |
| 92 | + prerelease: true |
| 93 | + generate_release_notes: false |
| 94 | + body: ${{ steps.release-notes.outputs.result }} |
| 95 | + tag_name: ${{ steps.version-and-tag.outputs.new_tag }} |
| 96 | + env: |
| 97 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + |
| 99 | + - name: Stop Deploy Message |
| 100 | + if: always() |
| 101 | + uses: Basis-Theory/github-actions/deploy-slack-action@master |
| 102 | + with: |
| 103 | + slack-api-token: ${{ secrets.SLACK_DUCKBOT_API_KEY }} |
| 104 | + channel: ${{ vars.SLACK_DUCKBOT_DEV_DEPLOY_CHANNEL_ID }} |
| 105 | + status: "done" |
0 commit comments