Skip to content

Commit

Permalink
fix workflow for version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
floryn90 committed Jan 8, 2024
1 parent de9b94b commit c49a056
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/version_bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ jobs:
echo "Latest release tag of gohugoio/hugo is ${release_tag}"
echo "hugo_latest_release_tag=${release_tag}" >> $GITHUB_ENV
- name: Identify latest release branch
- name: Identify latest release tag
run: |
git fetch -a origin
latest_branch=$(git branch -r --sort=committerdate | grep -E "*/release/*" | tail -1 | awk -F'/' '{print $NF}')
echo "My latest release branch is ${latest_branch}"
echo "latest_branch=${latest_branch}" >> $GITHUB_ENV
releases=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/floryn90/docker-hugo/releases?per_page=1&page=1)
my_release_tag=$(echo $releases | jq '.[0].tag_name' | sed 's/v//' | sed 's/"//g')
echo "My latest release tag is ${my_release_tag}"
echo "my_release_tag=${my_release_tag}" >> $GITHUB_ENV
- name: Configure Git User's information
run: |
git config --global user.email '[email protected]'
git config --global user.name 'Florin Lungu'
- name: Create new release branch and run version bump
if: env.latest_branch != env.hugo_latest_release_tag
if: env.my_release_tag != env.hugo_latest_release_tag
run: |
git checkout -b release/${{ env.hugo_latest_release_tag }}
version=${{env.hugo_latest_release_tag}} make bump
Expand All @@ -53,19 +53,19 @@ jobs:
- name: Create new PR with latest release branch
id: pr
if: env.latest_branch != env.hugo_latest_release_tag
if: env.my_release_tag != env.hugo_latest_release_tag
run: |
pr=$(gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/floryn90/docker-hugo/pulls -f title="Hugo version bump to ${{env.hugo_latest_release_tag}}" -f body="Hugo version bump to ${{env.hugo_latest_release_tag}}" -f head="release/${{env.hugo_latest_release_tag}}" -f base='master')
pr_number=$(echo $pr | jq '.number')
echo "pr_number=${pr_number}" >> $GITHUB_OUTPUT
- name: Merge the PR
if: env.latest_branch != env.hugo_latest_release_tag
if: env.my_release_tag != env.hugo_latest_release_tag
run: |
gh api --method PUT -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/floryn90/docker-hugo/pulls/${{ steps.pr.outputs.pr_number }}/merge -f commit_title="Merge PR ${{ steps.pr.outputs.pr_number }}" -f commit_message='Merge pull request to upgrade hugo version'
- name: Create new release tag
if: env.latest_branch != env.hugo_latest_release_tag
if: env.my_release_tag != env.hugo_latest_release_tag
run: |
gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/floryn90/docker-hugo/releases -f tag_name="v${{ env.hugo_latest_release_tag }}" -f target_commitish='master' -f name="Hugo version v${{env.hugo_latest_release_tag}}" -f body="Hugo release version bump to ${{env.hugo_latest_release_tag}}" -F draft=false -F prerelease=false -F generate_release_notes=false

0 comments on commit c49a056

Please sign in to comment.