-
-
Notifications
You must be signed in to change notification settings - Fork 2
62 lines (57 loc) · 1.95 KB
/
publish-artifact.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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 }}"