-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* push workflow added as common * fix lint * update workflow * update description * Update .github/workflows/push_network.yml Co-authored-by: Bikouo Aubin <[email protected]> --------- Co-authored-by: Bikouo Aubin <[email protected]>
- Loading branch information
1 parent
87ee190
commit 9a3714e
Showing
1 changed file
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# push workflow is shared and expected to perform actions after a merge happens | ||
# on a maintenance branch (default or release). For example updating the | ||
# draft release-notes. | ||
# based on great work from | ||
# https://github.com/T-Systems-MMS/ansible-collection-icinga-director | ||
name: push_network | ||
|
||
on: | ||
workflow_call: | ||
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callinputs | ||
inputs: | ||
repo: | ||
description: Repository url | ||
required: true | ||
type: string | ||
secrets: | ||
BOT_PAT: | ||
description: Bot secret | ||
required: true | ||
|
||
jobs: | ||
update_release_draft: | ||
runs-on: ubuntu-22.04 | ||
environment: push | ||
steps: | ||
- uses: actions/[email protected] | ||
with: | ||
repository: ${{ inputs.repo }} # ansible-collections/ansible.utils | ||
fetch-depth: 0 | ||
token: ${{ secrets.BOT_PAT }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install antsibull-changelog, antsichaut | ||
run: > | ||
python -m pip install | ||
antsibull-changelog | ||
git+https://github.com/ansible-community/antsichaut.git | ||
pre-commit | ||
--disable-pip-version-check | ||
- name: Run release drafter | ||
id: release_drafter | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Remove the v prefix from the release drafter version | ||
run: | | ||
VERSION=${{ steps.release_drafter.outputs.tag_name }} | ||
echo "VERSION=${VERSION#v}" >> $GITHUB_ENV | ||
- name: Generate new version in changelog.yaml | ||
run: antsibull-changelog release -v --version "${{ env.VERSION }}" | ||
|
||
- name: Get previous tag | ||
id: previoustag | ||
uses: "WyriHaximus/github-action-get-previous-tag@master" | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Generate changelog.yaml | ||
run: antsichaut | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SINCE_VERSION: "${{ steps.previoustag.outputs.tag }}" | ||
|
||
- name: Update Changelog.rst | ||
run: antsibull-changelog generate -v | ||
|
||
- name: Cleanup to use prettier | ||
run: pre-commit run prettier --all-files | ||
continue-on-error: true | ||
|
||
- name: Update the glaxay.yml version | ||
run: | | ||
pip install yq | ||
yq -yi ".version = \"${{ env.VERSION }}\"" galaxy.yml | ||
- name: Determine if a PR is necessary | ||
run: git diff --no-ext-diff --quiet --exit-code | ||
continue-on-error: true | ||
id: pr_check | ||
|
||
- name: Create PR for changelog | ||
run: | | ||
git config user.name "Ansible Bot" | ||
git config user.email [email protected] | ||
git checkout -t -b ${{ env.BRANCH_NAME }} | ||
git add . | ||
git commit -m "Changelog updated" | ||
git push origin ${{ env.BRANCH_NAME }} | ||
gh pr create --title "Changelog updated" --body "Changelog updated" --base main | ||
if: steps.pr_check.outcome == 'failure' | ||
env: | ||
GH_TOKEN: ${{ secrets.BOT_PAT }} | ||
BRANCH_NAME: chore-${{ github.workflow }}-${{ github.run_number }} |