Skip to content

Icinga2-1.1.8_oec-1.1.4 #102

Icinga2-1.1.8_oec-1.1.4

Icinga2-1.1.8_oec-1.1.4 #102

Workflow file for this run

name: Update README.md
on:
release:
types: [published]
jobs:
update-readme:
name: Update version on README.md
runs-on: ubuntu-latest
steps:
- name: Set name and version of release to env
id: setup
run: |
IFS='-' read -r name version <<< "$(basename $GITHUB_REF)"
echo ::set-output name=INTEGRATION_NAME::$name
echo ::set-output name=INTEGRATION_VERSION::$version
- name: Checkout the repository with branch
uses: actions/checkout@v2
- name: Set branch name to env
id: prepare-branch-name
run: |
branchName=after-release-$(cat release/oec-builder/readmeIterationCount)
echo branchName:$branchName
echo ::set-output name=BRANCH_NAME::$(echo $branchName)
- name: Commit and push changes
env:
BRANCH_NAME: ${{ steps.prepare-branch-name.outputs.branch_name }}
INTEGRATION_NAME: ${{ steps.setup.outputs.integration_name }}
INTEGRATION_VERSION: ${{ steps.setup.outputs.integration_version }}
run: |
git config --global user.name 'Github Actions'
git config --global user.email 'support@atlassian.com'
git checkout ${{ env.BRANCH_NAME }} 2>/dev/null || git checkout -b ${{ env.BRANCH_NAME }}
if (($(git ls-remote origin ${{ env.BRANCH_NAME }} | wc -l) > 0));
then
echo "Branch already exists will rebase..."
git pull origin ${{ env.BRANCH_NAME }} --rebase
else
echo "Increase iteration count...."
iterationCount=$(($(cat release/oec-builder/readmeIterationCount) + 1))
echo $iterationCount > release/oec-builder/readmeIterationCount
fi
echo "Update readme file..."
sed -i 's/\(tag\/${{ env.INTEGRATION_NAME }}-\).*)/\1${{ env.INTEGRATION_VERSION }})/gi' README.md
grep --color -ie "${{ env.INTEGRATION_NAME }}" README.md
git commit -am "Update README.md after release(s)"
git push origin ${{ env.BRANCH_NAME }}
- name: Create pull request if not exist
env:
BRANCH_NAME: ${{ steps.prepare-branch-name.outputs.branch_name }}
uses: repo-sync/pull-request@v2
with:
source_branch: ${{ env.BRANCH_NAME }}
pr_title: "Update README.md after release(s)"
destination_branch: "master"
pr_reviewer: ${{ github.actor }}
github_token: ${{ secrets.GITHUB_TOKEN }}