Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
ci: fix release workflow (#751)
Browse files Browse the repository at this point in the history
* ci: combines release creation and upload of assets

Signed-off-by: Joerg Poecher <[email protected]>

* ci: replaces create-pull-request action with vanilla git/gh commands

and fixes incorrect tagging due to commit amend

Signed-off-by: Joerg Poecher <[email protected]>
  • Loading branch information
j-poecher authored Mar 23, 2022
1 parent 96349cd commit 461ec35
Showing 1 changed file with 30 additions and 36 deletions.
66 changes: 30 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,41 +282,42 @@ jobs:
--skip.changelog
fi
echo "::set-output name=tag-name::$(git describe --tags --abbrev=0)"
TAG="$(git describe --tags --abbrev=0)"
echo "::set-output name=tag-name::$TAG"
echo "Sign off commit"
git commit --amend --signoff --no-edit
echo "Tag again due to amending last commit"
git tag -f -a -m "release $TAG" "$TAG"
- name: Push changes to repo
id: push-changes
env:
RELEASE_TAG: ${{ steps.create-release-package.outputs.tag-name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Fetching previously deleted old tags..."
git fetch origin --tags -f
echo "Sign off commit"
git commit --amend --signoff --no-edit
TARGET_BRANCH=release/$RELEASE_TAG
- name: Create Release Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.KEPTN_BOT_TOKEN }}
commit-message: "build: release ${{ steps.create-release-package.outputs.tag-name }}"
committer: ${{ env.KEPTN_BOT_NAME }} <${{ env.KEPTN_BOT_EMAIL }}>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: true
branch: release/${{ steps.create-release-package.outputs.tag-name }}
delete-branch: true
title: "build: release ${{ steps.create-release-package.outputs.tag-name }}"
body: |
Updates to CHANGELOG.md, VERSION.txt, README.md and compatibility.md
labels: |
release
assignees: ${{ github.actor }}
team-reviewers: |
owners
maintainers
draft: false

- name: Push Tags
# delete existing branch just in case
git branch -D $TARGET_BRANCH &>/dev/null || true
# create new branch
git checkout -b $TARGET_BRANCH
# push changes
echo "⚡️ Pushing changes to remote repository..."
git push -f --follow-tags --set-upstream origin $TARGET_BRANCH
- name: Create GitHub Pull Request
env:
GITHUB_TOKEN: ${{ secrets.KEPTN_BOT_TOKEN }}
RELEASE_TAG: ${{ steps.create-release-package.outputs.tag-name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push --follow-tags origin "release/$RELEASE_TAG"
gh pr create --title "build: release $RELEASE_TAG" --body "Updates to CHANGELOG.md, VERSION.txt, README.md and compatibility.md" --base "${GITHUB_REF_NAME}"
- name: Download Release Artifacts
uses: actions/download-artifact@v2
Expand All @@ -325,14 +326,7 @@ jobs:

- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.KEPTN_BOT_TOKEN }}
RELEASE_TAG: ${{ steps.create-release-package.outputs.tag-name }}
run: |
gh release create "$RELEASE_TAG" --notes-file "${{ env.RELEASE_NOTES_FILE }}" --title "$RELEASE_TAG"
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.KEPTN_BOT_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.create-release-package.outputs.tag-name }}
run: |
gh release upload "$RELEASE_TAG" ./dist/installer/*.tgz
gh release create "${{ env.RELEASE_TAG }}" --notes-file "${{ env.RELEASE_NOTES_FILE }}" --title "${{ env.RELEASE_TAG }}" ./dist/installer/*.tgz

0 comments on commit 461ec35

Please sign in to comment.