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:
|
with:
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|
||||||
- name: Create docs branch
|
|
||||||
run: |
|
|
||||||
git fetch
|
|
||||||
git pull
|
|
||||||
git checkout "${BRANCH}" || git checkout -B "${BRANCH}"
|
|
||||||
|
|
||||||
- name: Create docs release
|
- name: Create docs release
|
||||||
working-directory: docs
|
working-directory: docs
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
npm run docusaurus docs:version "${MAJOR_MINOR}"
|
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
|
- 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:
|
with:
|
||||||
source_branch: ${{env.BRANCH}}
|
branch: ${BRANCH}
|
||||||
destination_branch: "main"
|
base: main
|
||||||
pr_title: "docs: add release ${VERSION}"
|
title: "docs: add release ${VERSION}"
|
||||||
pr_body: |
|
body: |
|
||||||
:robot: *This is an automated PR.* :robot:
|
:robot: *This is an automated PR.* :robot:
|
||||||
|
|
||||||
The PR is triggered as part of the automated release process of version ${VERSION}.
|
The PR is triggered as part of the automated release process of version ${VERSION}.
|
||||||
It releases a new version of the documentation.
|
It releases a new version of the documentation.
|
||||||
pr_label: "no-changelog"
|
commit-message: "docs: add release ${VERSION}"
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
committer: edgelessci <edgelessci@users.noreply.github.com>
|
||||||
|
labels: no-changelog
|
||||||
|
|
||||||
prepare-release-branch:
|
prepare-release-branch:
|
||||||
name: Prepare release branch
|
name: Prepare release branch
|
||||||
@ -332,7 +319,7 @@ jobs:
|
|||||||
VERSION: ${{ inputs.version }}
|
VERSION: ${{ inputs.version }}
|
||||||
NEW_BRANCH: feat/release/${{ inputs.version }}/changes-to-main
|
NEW_BRANCH: feat/release/${{ inputs.version }}/changes-to-main
|
||||||
steps:
|
steps:
|
||||||
- name: Checkot
|
- name: Checkout
|
||||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
with:
|
with:
|
||||||
ref: ${{ needs.verify-inputs.outputs.RELEASE_BRANCH }}
|
ref: ${{ needs.verify-inputs.outputs.RELEASE_BRANCH }}
|
||||||
@ -345,16 +332,17 @@ jobs:
|
|||||||
git checkout -b "${NEW_BRANCH}"
|
git checkout -b "${NEW_BRANCH}"
|
||||||
git push --set-upstream origin "${NEW_BRANCH}"
|
git push --set-upstream origin "${NEW_BRANCH}"
|
||||||
|
|
||||||
- name: Create pull request
|
- name: Create PR
|
||||||
uses: repo-sync/pull-request@65785d95a5a466e46a9d0708933a3bd51bbf9dde # tag=v2.6.2
|
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
|
||||||
with:
|
with:
|
||||||
source_branch: ${{ env.NEW_BRANCH }}
|
branch: ${{ env.NEW_BRANCH }}
|
||||||
destination_branch: "main"
|
base: main
|
||||||
pr_title: "release: bring back changes from ${VERSION}"
|
title: "release: bring back changes from ${VERSION}"
|
||||||
pr_body: |
|
body: |
|
||||||
:robot: *This is an automated PR.* :robot:
|
:robot: *This is an automated PR.* :robot:
|
||||||
|
|
||||||
This PR is triggered as part of the release process of version ${VERSION}.
|
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.
|
It brings back changes from the release branch into the main branch.
|
||||||
pr_label: "no-changelog"
|
commit-message: "release: bring back changes from ${VERSION}"
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
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:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
@ -10,9 +11,8 @@ on:
|
|||||||
- "hack/clidocgen/**"
|
- "hack/clidocgen/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-to-docs:
|
update-docs:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Constellation
|
- name: Checkout Constellation
|
||||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
@ -25,43 +25,25 @@ jobs:
|
|||||||
go-version: "1.19.5"
|
go-version: "1.19.5"
|
||||||
cache: true
|
cache: true
|
||||||
|
|
||||||
- name: Generate reference docs
|
- name: Regenerate CLI reference of the documentation
|
||||||
working-directory: hack/clidocgen
|
working-directory: hack/clidocgen
|
||||||
run: go run . | cat header.md - > ../../cli.md
|
run: go run . | cat header.md - > ../../cli.md
|
||||||
|
|
||||||
- name: Get commit sha
|
- name: Create PR (if there are changes)
|
||||||
run: |
|
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4.2.3
|
||||||
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
|
|
||||||
with:
|
with:
|
||||||
source_file: "cli.md"
|
branch: ci/cli-ref/update
|
||||||
destination_repo: "edgelesssys/constellation"
|
base: main
|
||||||
destination_branch_create: "action/constellation/update-cli-reference"
|
title: "docs: update cli reference"
|
||||||
destination_folder: "docs/docs/reference"
|
body: |
|
||||||
user_name: "${{ github.actor }}"
|
:robot: *This is an automated PR.* :robot:
|
||||||
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 }}
|
|
||||||
|
|
||||||
- name: Publish new reference (update branch)
|
Changes in the CLI triggered this PR, it updates the corresponding documentation page.
|
||||||
if: env.EXISTS == 1
|
|
||||||
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 # tag=v1.1.1
|
If there is anything wrong with the content of this PR, **please don't do changes on this PR**,
|
||||||
with:
|
rather make the changes in the CLI code and open a separate PR.
|
||||||
source_file: "cli.md"
|
You can leave this PR open (it will be updated, use a "hold" label) or close it (a new PR will
|
||||||
destination_repo: "edgelesssys/constellation"
|
be created automatically on new changes on main).
|
||||||
destination_branch: "action/constellation/update-cli-reference"
|
commit-message: "docs: update cli reference"
|
||||||
destination_folder: "docs/docs/reference"
|
committer: edgelessci <edgelessci@users.noreply.github.com>
|
||||||
user_name: "${{ github.actor }}"
|
labels: no-changelog
|
||||||
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 }}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user