forked from klakegg/docker-hugo
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
9 additions
and
9 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 |
---|---|---|
|
@@ -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 | ||
|
@@ -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 | ||