stage-app-push #1579
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: stage-app-push | |
on: | |
workflow_run: | |
workflows: | |
- build | |
types: | |
- completed | |
# Disable all permissions. We have to enable required permissions at job-level. | |
permissions: {} | |
jobs: | |
stage-default: | |
if: > | |
github.event.workflow_run.event == 'push' && | |
github.event.workflow_run.conclusion == 'success' | |
permissions: | |
actions: read # for listing workflow run artifacts | |
contents: read # for checkout | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
repository: droidkaigi/conference-app-2024 | |
ref: gh-actions | |
path: gh-actions | |
- uses: actions/github-script@v7 | |
id: get-artifact-id | |
with: | |
result-encoding: string | |
script: | | |
const { data: resp } = await github.rest.actions.listWorkflowRunArtifacts({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
run_id: ${{ github.event.workflow_run.id }} | |
}) | |
const artifact = resp.artifacts.find((a) => a.name === "build-outputs") | |
if (artifact) { | |
return artifact.id | |
} else { | |
return '[halt]' | |
} | |
- uses: ./gh-actions/actions/get-artifact | |
id: get-artifact | |
if: steps.get-artifact-id.outputs.result != '[halt]' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
artifact-id: ${{ steps.get-artifact-id.outputs.result }} | |
path: ~/build-outputs | |
- run: > | |
unzip ${{ steps.get-artifact.outputs.archive-path }} -d ~/build-outputs && | |
rm -f ${{ steps.get-artifact.outputs.archive-path }} | |
- uses: ./gh-actions/actions/find-files | |
id: find-dev-debug-apk | |
with: | |
pattern: "~/build-outputs/**/app-android-dev-debug.apk" | |
- uses: jmatsu/[email protected] | |
id: upload | |
with: | |
app_owner_name: droidkaigi | |
api_token: ${{ secrets.DEPLOYGATE_API_TOKEN }} | |
app_file_path: ${{ fromJSON(steps.find-dev-debug-apk.outputs.paths)[0] }} | |
message: GitHub Actions have staged an artifact of ${{ github.ref }} / ${{ github.sha }} | |
distribution_find_by: name | |
distribution_id: ${{ format('staging/{0}', github.ref) }} | |
release_note: ${{ format('[main] Workflow {0}/{1} based on {2}', github.run_id , github.run_number , github.sha) }} | |
pin: false |