Publish Artifact #170
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: Publish Artifact | |
on: | |
workflow_dispatch: | |
inputs: | |
destination_path: | |
type: string | |
required: true | |
artifact_repo: | |
type: string | |
required: true | |
artifact_commit: | |
type: string | |
required: false | |
default: "" | |
artifact_workflow: | |
type: string | |
required: false | |
default: "generate-docs.yml" | |
artifact_name: | |
type: string | |
required: false | |
default: "docs" | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Wait for workflow queue | |
uses: ahmadnassri/action-workflow-queue@v1 | |
- name: Download artifact ${{ github.event.inputs.artifact_repo }} | |
id: download_artifact | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
github_token: ${{ secrets.DOCS_TOKEN }} | |
workflow: ${{ github.event.inputs.artifact_workflow }} | |
commit: ${{ github.event.inputs.artifact_commit }} | |
repo: ${{ github.event.inputs.artifact_repo }} | |
name: ${{ github.event.inputs.artifact_name }} | |
path: docs | |
- name: Format commit message | |
id: format_commit | |
shell: bash | |
env: | |
COMMIT_INPUT: ${{ github.event.inputs.artifact_commit }} | |
run: | | |
[ -z "$COMMIT_INPUT" ] && echo "::set-output name=commit::" || echo "::set-output name=commit::@${COMMIT_INPUT::7}" | |
- name: Publish ${{ github.event.inputs.destination_path }} | |
id: publish_pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.DOCS_TOKEN }} | |
destination_dir: ${{ github.event.inputs.destination_path }} | |
publish_branch: main | |
publish_dir: docs | |
user_name: "github-actions[bot]" | |
user_email: "github-actions[bot]@users.noreply.github.com" | |
full_commit_message: "deploy: ${{ github.event.inputs.artifact_repo }}${{ steps.format_commit.outputs.commit }}" |