Deep linking setup #740
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Demo builds | |
on: | |
pull_request: | |
branches: [ main ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run_checker: | |
runs-on: ubuntu-latest | |
name: Check legibility | |
outputs: | |
should_run: ${{steps.PR.outputs.pr_found == 'true' && contains(steps.PR.outputs.pr_labels, 'build-demo')}} | |
pr_num: ${{steps.PR.outputs.number}} | |
steps: | |
- uses: 8BitJonny/[email protected] | |
id: PR | |
with: | |
# Verbose setting SHA when using Pull_Request event trigger to fix #16. (For push even trigger this is not necessary.) | |
sha: ${{ github.event.pull_request.head.sha }} | |
# Only return if PR is still open. (By default it returns PRs in any state.) | |
filterOutClosed: true | |
# Only return if PR is not in draft state. (By default it returns PRs in any state.) | |
# filterOutDraft: true | |
- run: echo "PR $prNumber $prTitle at $prUrl is labeled $prLabels. It should run a demo build; $contains" | |
if: steps.PR.outputs.pr_found == 'true' | |
env: | |
# Direct access to common PR properties | |
prNumber: ${{ steps.PR.outputs.number }} | |
prUrl: ${{ steps.PR.outputs.pr_url }} | |
prTitle: ${{ steps.PR.outputs.pr_title }} | |
prBody: ${{ steps.PR.outputs.pr_body }} | |
prCreatedAt: ${{ steps.PR.outputs.pr_created_at }} | |
prMergedAt: ${{ steps.PR.outputs.pr_merged_at }} | |
prClosedAt: ${{ steps.PR.outputs.pr_closed_at }} | |
prLabels: ${{ steps.PR.outputs.pr_labels }} | |
contains: ${{ contains(steps.PR.outputs.pr_labels, 'build-demo') }} | |
tags: | |
runs-on: ubuntu-latest | |
# Map a step output to a job output | |
outputs: | |
tag: ${{ steps.tag.outputs.tag }} | |
build_num: ${{ steps.build_num.outputs.build_num }} | |
steps: | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/[email protected] | |
- id: tag | |
name: Create Tag | |
run: echo "tag=${{ steps.branch-name.outputs.current_branch }}-`date +%FT%H%M`" >> $GITHUB_OUTPUT | |
shell: bash | |
- id: build_num | |
run: echo "build_num=`date +%s`" >> $GITHUB_OUTPUT | |
build: | |
uses: ./.github/workflows/build-app.yml | |
needs: | |
- run_checker | |
- tags | |
if: ${{ needs.run_checker.outputs.should_run != 'false' }} | |
with: | |
artifacts_prefix: 'demo-' | |
release_tag: demo-${{ needs.tags.outputs.tag }} | |
release_env: demo | |
build_num: ${{ needs.tags.outputs.build_num }} | |
version: ${{ needs.tags.outputs.tag }} | |
env_extra: "IS_DEMO=true" | |
targets: android,linux,ios,macos,windows-exe # skip: windows-msix | |
secrets: inherit | |
comment: | |
runs-on: ubuntu-latest | |
needs: | |
- run_checker | |
- tags | |
- build | |
if: ${{ needs.run_checker.outputs.should_run != 'false' }} | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: ${{needs.run_checker.outputs.pr_num}}, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: '[Your demo build ${{ needs.tags.outputs.tag }} is ready](${{env.GITHUB_SERVER_URL}}/${{env.GITHUB_REPOSITORY}}/actions/runs/${{env.GITHUB_RUN_ID}})' | |
}) |