mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
ci: use peter-evans' action to create prs
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
2d326ea3f0
commit
bb419bdee5
25
.github/workflows/docs-update-reference.yml
vendored
25
.github/workflows/docs-update-reference.yml
vendored
@ -1,25 +0,0 @@
|
||||
name: Create Pull Request for CLI reference update
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- action/constellation/update-cli-reference
|
||||
|
||||
jobs:
|
||||
pull-request:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
ref: ${{ !github.event.pull_request.head.repo.fork && github.head_ref || '' }}
|
||||
|
||||
- name: pull-request
|
||||
uses: repo-sync/pull-request@65785d95a5a466e46a9d0708933a3bd51bbf9dde # tag=v2.6.2
|
||||
with:
|
||||
destination_branch: "main"
|
||||
pr_title: "docs: update cli reference"
|
||||
pr_body: |
|
||||
:robot: *This is an automated PR.* :robot:
|
||||
|
||||
Changes in the CLI triggered this PR, it updates the corresponding documentation page.
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
48
.github/workflows/release.yml
vendored
48
.github/workflows/release.yml
vendored
@ -69,39 +69,26 @@ jobs:
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Create docs branch
|
||||
run: |
|
||||
git fetch
|
||||
git pull
|
||||
git checkout "${BRANCH}" || git checkout -B "${BRANCH}"
|
||||
|
||||
- name: Create docs release
|
||||
working-directory: docs
|
||||
run: |
|
||||
npm install
|
||||
npm run docusaurus docs:version "${MAJOR_MINOR}"
|
||||
|
||||
- name: Commit
|
||||
run: |
|
||||
git config --global user.name "release[bot]"
|
||||
git config --global user.email "release[bot]@users.noreply.github.com"
|
||||
git add docs
|
||||
git commit -m "docs: generate docs for ${VERSION}"
|
||||
git push --set-upstream origin "${BRANCH}"
|
||||
|
||||
- name: Create docs pull request
|
||||
uses: repo-sync/pull-request@65785d95a5a466e46a9d0708933a3bd51bbf9dde # tag=v2.6.2
|
||||
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
|
||||
with:
|
||||
source_branch: ${{env.BRANCH}}
|
||||
destination_branch: "main"
|
||||
pr_title: "docs: add release ${VERSION}"
|
||||
pr_body: |
|
||||
branch: ${BRANCH}
|
||||
base: main
|
||||
title: "docs: add release ${VERSION}"
|
||||
body: |
|
||||
:robot: *This is an automated PR.* :robot:
|
||||
|
||||
The PR is triggered as part of the automated release process of version ${VERSION}.
|
||||
It releases a new version of the documentation.
|
||||
pr_label: "no-changelog"
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: "docs: add release ${VERSION}"
|
||||
committer: edgelessci <edgelessci@users.noreply.github.com>
|
||||
labels: no-changelog
|
||||
|
||||
prepare-release-branch:
|
||||
name: Prepare release branch
|
||||
@ -332,7 +319,7 @@ jobs:
|
||||
VERSION: ${{ inputs.version }}
|
||||
NEW_BRANCH: feat/release/${{ inputs.version }}/changes-to-main
|
||||
steps:
|
||||
- name: Checkot
|
||||
- name: Checkout
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
with:
|
||||
ref: ${{ needs.verify-inputs.outputs.RELEASE_BRANCH }}
|
||||
@ -345,16 +332,17 @@ jobs:
|
||||
git checkout -b "${NEW_BRANCH}"
|
||||
git push --set-upstream origin "${NEW_BRANCH}"
|
||||
|
||||
- name: Create pull request
|
||||
uses: repo-sync/pull-request@65785d95a5a466e46a9d0708933a3bd51bbf9dde # tag=v2.6.2
|
||||
- name: Create PR
|
||||
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
|
||||
with:
|
||||
source_branch: ${{ env.NEW_BRANCH }}
|
||||
destination_branch: "main"
|
||||
pr_title: "release: bring back changes from ${VERSION}"
|
||||
pr_body: |
|
||||
branch: ${{ env.NEW_BRANCH }}
|
||||
base: main
|
||||
title: "release: bring back changes from ${VERSION}"
|
||||
body: |
|
||||
:robot: *This is an automated PR.* :robot:
|
||||
|
||||
This PR is triggered as part of the release process of version ${VERSION}.
|
||||
It brings back changes from the release branch into the main branch.
|
||||
pr_label: "no-changelog"
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: "release: bring back changes from ${VERSION}"
|
||||
committer: edgelessci <edgelessci@users.noreply.github.com>
|
||||
labels: no-changelog
|
||||
|
58
.github/workflows/update-cli-reference.yml
vendored
58
.github/workflows/update-cli-reference.yml
vendored
@ -1,4 +1,5 @@
|
||||
name: Publish CLI reference to documentation
|
||||
name: Update the CLI reference page of the documentation
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
@ -10,9 +11,8 @@ on:
|
||||
- "hack/clidocgen/**"
|
||||
|
||||
jobs:
|
||||
publish-to-docs:
|
||||
update-docs:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checkout Constellation
|
||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||
@ -25,43 +25,25 @@ jobs:
|
||||
go-version: "1.19.5"
|
||||
cache: true
|
||||
|
||||
- name: Generate reference docs
|
||||
- name: Regenerate CLI reference of the documentation
|
||||
working-directory: hack/clidocgen
|
||||
run: go run . | cat header.md - > ../../cli.md
|
||||
|
||||
- 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 # tag=v1.1.1
|
||||
- name: Create PR (if there are changes)
|
||||
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
|
||||
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}}"
|
||||
env:
|
||||
API_TOKEN_GITHUB: ${{ secrets.CI_GITHUB_REPOSITORY }}
|
||||
branch: ci/cli-ref/update
|
||||
base: main
|
||||
title: "docs: update cli reference"
|
||||
body: |
|
||||
:robot: *This is an automated PR.* :robot:
|
||||
|
||||
- name: Publish new reference (update branch)
|
||||
if: env.EXISTS == 1
|
||||
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 # tag=v1.1.1
|
||||
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}}"
|
||||
env:
|
||||
API_TOKEN_GITHUB: ${{ secrets.CI_GITHUB_REPOSITORY }}
|
||||
Changes in the CLI triggered this PR, it updates the corresponding documentation page.
|
||||
|
||||
If there is anything wrong with the content of this PR, **please don't do changes on this PR**,
|
||||
rather make the changes in the CLI code and open a separate PR.
|
||||
You can leave this PR open (it will be updated, use a "hold" label) or close it (a new PR will
|
||||
be created automatically on new changes on main).
|
||||
commit-message: "docs: update cli reference"
|
||||
committer: edgelessci <edgelessci@users.noreply.github.com>
|
||||
labels: no-changelog
|
||||
|
Loading…
Reference in New Issue
Block a user