Skip to content

Canary release from fork #538

Canary release from fork

Canary release from fork #538

name: Canary release from fork
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.id }}
cancel-in-progress: true
on:
workflow_run:
workflows: ['Build PR From Fork']
types: ['completed']
branches-ignore: ['master']
jobs:
prepare_jobs:
runs-on: ubuntu-latest
if: |
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
outputs:
pr_commit_sha: '${{ steps.set_pr_info.outputs.pr_commit_sha }}'
pr_number: '${{ steps.set_pr_info.outputs.pr_number }}'
steps:
- name: Download PR info
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.0
with:
workflow: build-fork.yml
run_id: '${{ github.event.workflow_run.id }}'
workflow_conclusion: success
name: pr
path: ./
- name: Set PR info
id: set_pr_info
shell: sh
run: |
echo "::set-output name=pr_commit_sha::$(cat SHA | tr -dc 'a-f0-9' | head -c40)"
echo "::set-output name=pr_number::$(cat NUM | tr -dc '[:digit:]')"
prerelease:
runs-on: ubuntu-latest
needs: ['prepare_jobs']
env:
pr_commit_sha: '${{ needs.prepare_jobs.outputs.pr_commit_sha }}'
pr_number: '${{ needs.prepare_jobs.outputs.pr_number }}'
steps:
- uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 # v3.0.0
with:
token: '${{ secrets.BOT_TOKEN }}'
- name: Download math-utils build
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.0
with:
workflow: build-fork.yml
run_id: '${{ github.event.workflow_run.id }}'
workflow_conclusion: success
name: math-utils
path: packages/math-utils/dist
- name: Download contract-helpers build
uses: dawidd6/action-download-artifact@575b1e4167df67acf7e692af784566618b23c71e # v2.17.0
with:
workflow: build-fork.yml
run_id: '${{ github.event.workflow_run.id }}'
workflow_conclusion: success
name: contract-helpers
path: packages/contract-helpers/dist
- name: prerelease
shell: bash
run: |
yarn release:canary \
--yes --no-verify-access \
--dist-tag "${pr_commit_sha}" --preid "${pr_commit_sha}" \
| tee __publish-log.txt
- name: Comment on PR
if: success()
uses: ./.github/actions/pr-comment
with:
PR_NUMBER: '${{ env.pr_number }}'
- name: Notify about failure
if: failure()
uses: actions/github-script@9ac08808f993958e9de277fe43a64532a609130e # v6.0.0
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number('${{ env.pr_number }}'),
body: '❌ Something went wrong with canary release\nPlease see logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
});