|
| 1 | +name: Canary Release |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +env: |
| 9 | + NODE_VERSION_USED_FOR_DEVELOPMENT: 17 |
| 10 | +jobs: |
| 11 | + publish-canary: |
| 12 | + name: Publish Canary |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout Main |
| 16 | + uses: actions/checkout@v2 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + persist-credentials: false |
| 20 | + |
| 21 | + - name: Setup Node.js |
| 22 | + uses: actions/setup-node@v2 |
| 23 | + with: |
| 24 | + cache: npm |
| 25 | + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} |
| 26 | + |
| 27 | + - name: Install Dependencies |
| 28 | + run: npm ci --ignore-scripts |
| 29 | + |
| 30 | + - name: Setup NPM credentials |
| 31 | + run: echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" >> ~/.npmrc |
| 32 | + env: |
| 33 | + NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} |
| 34 | + |
| 35 | + - name: Release Canary |
| 36 | + id: canary |
| 37 | + uses: 'kamilkisiela/release-canary@master' |
| 38 | + with: |
| 39 | + npm-token: ${{ secrets.NODE_AUTH_TOKEN }} |
| 40 | + npm-script: 'npm run release:canary' |
| 41 | + changesets: true |
| 42 | + |
| 43 | + - name: Publish a message |
| 44 | + if: steps.canary.outputs.released |
| 45 | + uses: 'kamilkisiela/pr-comment@master' |
| 46 | + with: |
| 47 | + message: | |
| 48 | + The latest changes of this PR are available as alpha in npm (based on the declared `changesets`): |
| 49 | + ``` |
| 50 | + ${{ steps.canary.outputs.changesetsPublishedPackages}} |
| 51 | + ``` |
| 52 | + bot-token: ${{ secrets.GH_API_TOKEN }} |
| 53 | + bot: 'theguild-bot' |
| 54 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 55 | + |
| 56 | + - name: Publish a empty message |
| 57 | + if: steps.canary.outputs.released == 'false' |
| 58 | + uses: 'kamilkisiela/pr-comment@master' |
| 59 | + with: |
| 60 | + message: | |
| 61 | + The latest changes of this PR are not available as alpha, since there are no linked `changesets` for this PR. |
| 62 | + bot-token: ${{ secrets.GH_API_TOKEN }} |
| 63 | + bot: 'theguild-bot' |
| 64 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments