constellation/.github/workflows/update-cli-reference.yml
dependabot[bot] fdd4425974
Bump actions/checkout from 3.0.2 to 3.1.0 (#210)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.0.2 to 3.1.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](2541b1294d...93ea575cb5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-05 09:24:36 +02:00

66 lines
2.4 KiB
YAML

name: Publish CLI reference to documentation
on:
push:
branches:
- main
paths:
- "cli/cmd/**"
- "cli/internal/cmd/**"
- "hack/clidocgen/**"
workflow_dispatch:
jobs:
publish-to-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout Constellation
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
- name: Setup Go environment
uses: actions/setup-go@268d8c0ca0432bb2cf416faae41297df9d262d7f
with:
go-version: "1.19.1"
cache: true
- name: Generate reference docs
run: 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
run: |
ex=$(git ls-remote --heads origin action/constellation/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
env:
API_TOKEN_GITHUB: ${{ secrets.CI_GITHUB_REPOSITORY }}
with:
source_file: "cli.md"
destination_repo: "edgelesssys/constellation"
destination_branch_create: "action/constellation/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/constellation@${{ env.COMMIT_END}}"
- name: Publish new reference (update branch)
if: ${{ env.EXISTS == 1 }}
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37
env:
API_TOKEN_GITHUB: ${{ secrets.CI_GITHUB_REPOSITORY }}
with:
source_file: "cli.md"
destination_repo: "edgelesssys/constellation"
destination_branch: "action/constellation/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/constellation@${{ env.COMMIT_END}}"