Skip to content

Deploy

Deploy #770

name: Deploy
on:
workflow_run:
workflows:
- GitHub Pages
branches:
- master
types:
- completed
jobs:
deploy-pages:
name: Deploy Pages
# https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md
runs-on: macos-13
if: >
${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download artifact
uses: actions/github-script@v6
with:
script: |
var artifactName = 'mobile-app-crib-notes'
var artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == artifactName
})[0];
if (!matchArtifact) {
core.setFailed(`${artifactName} is not found in artifacts`);
return;
}
var download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/' + artifactName + '.zip', Buffer.from(download.data));
- name: Extract artifact
run: unzip -d mobile-app-crib-notes mobile-app-crib-notes.zip
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./mobile-app-crib-notes