-
Notifications
You must be signed in to change notification settings - Fork 34
68 lines (60 loc) · 2.56 KB
/
update-cli-reference.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
63
64
65
66
67
68
name: Publish CLI reference to documentation
on:
workflow_dispatch:
push:
branches:
- master
paths:
- "cli/**"
- "hack/clidocgen/**"
jobs:
publish-to-docs:
runs-on: ubuntu-24.04
container:
image: ghcr.io/edgelesssys/edgelessrt-dev:ci
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
- name: Setup
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Generate reference docs
run: XDG_CONFIG_HOME=\$HOME/.config go run . | cat header.md - > ../../cli.md
working-directory: hack/clidocgen
- name: Get commit sha
run: |
echo "COMMIT_END=$(echo ${{ github.sha }} | cut -c1-8)" >> "$GITHUB_ENV"
- name: Check if action branch exists
shell: bash -e {0}
run: |
ex="$(git ls-remote --heads origin action/marblerun/update-cli-reference)"
echo "EXISTS=$(if [[ -z "$ex" ]]; then echo 0; else echo 1; fi)" >> "$GITHUB_ENV"
- name: Publish new reference (create new branch)
if: ${{ env.EXISTS == 0 }}
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 # v1.1.1
env:
API_TOKEN_GITHUB: ${{ secrets.CI_GITHUB_REPOSITORY }}
with:
source_file: "cli.md"
destination_repo: "edgelesssys/marblerun"
destination_branch: "master"
destination_branch_create: "action/marblerun/update-cli-reference"
destination_folder: "docs/docs/reference"
user_name: "${{ github.actor }}"
user_email: "${{ github.actor }}@users.noreply.github.com"
commit_message: "CLI reference was updated by edgelesssys/marblerun@${{ env.COMMIT_END}}"
- name: Publish new reference (update branch)
if: ${{ env.EXISTS == 1 }}
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 # v1.1.1
env:
API_TOKEN_GITHUB: ${{ secrets.CI_GITHUB_REPOSITORY }}
with:
source_file: "cli.md"
destination_repo: "edgelesssys/marblerun"
destination_branch: "action/marblerun/update-cli-reference"
destination_folder: "docs/docs/reference"
user_name: "${{ github.actor }}"
user_email: "${{ github.actor }}@users.noreply.github.com"
commit_message: "CLI reference was updated by edgelesssys/marblerun@${{ env.COMMIT_END}}"