Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: finalize github release action #263

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions .github/workflows/release_github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ on:
- patch
- minor
- major
release_branch:
description: "Branch to use for releasing."
type: string
default: "test_protected_develop"

permissions:
contents: write
Expand All @@ -28,6 +24,12 @@ jobs:
shell: bash -l {0}

steps:
- name: Fail if main branch was selected
if: ${{ github.ref_name }} == 'main'
run: |
echo "Cannot release from main branch, please select valid release branch."
exit 1

- name: Checkout repository
uses: actions/checkout@v4
with:
Expand All @@ -41,8 +43,8 @@ jobs:

- name: Merge changes into main
run: |
git switch test_protected_main
git merge ${{ github.event.inputs.release_branch }} --no-ff --no-commit
git switch main
git merge ${{ github.ref_name }} --no-ff --no-commit
git merge --continue

- name: Bump version
Expand Down Expand Up @@ -92,8 +94,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "-- searching for associated PR"
branch_name=${{ github.event.inputs.release_branch }}
pr_number=$(gh pr list --head $branch_name --json number --jq '.[0].number')
pr_number=$(gh pr list --head ${{ github.ref_name }} --json number --jq '.[0].number')
if [ -n "$pr_number" ]; then
echo "-- closing PR #$pr_number"
gh pr close $pr_number
Expand All @@ -103,15 +104,15 @@ jobs:

- name: Merge updates into develop
run: |
git switch test_protected_develop
git merge origin/test_protected_main
git switch develop
git merge origin/main
git push

- name: Delete release branch other than main or develop
run: |
if [[ ${{ github.event.inputs.release_branch}} != "test_protected_main" && ${{ github.event.inputs.release_branch}} != "test_protected_develop" ]]; then
echo "-- deleting branch '${{ github.event.inputs.release_branch }}'"
git push origin -d ${{ github.event.inputs.release_branch }}
if [[ ${{ github.ref_name }} != "main" && ${{ github.ref_name }} != "develop" ]]; then
echo "-- deleting branch '${{ github.ref_name }}'"
git push origin -d ${{ github.ref_name }}
else
echo "-- branch '${{ github.event.inputs.release_branch}}' will not be deleted from remote"
echo "-- branch '${{ github.ref_name }}' will not be deleted from remote"
fi
10 changes: 6 additions & 4 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,15 @@ We use [prettier](https://prettier.io/) for formatting most other files. If you
- if everything goes well, this PR will automatically be closed after the draft release is created.
1. Navigate to [Draft Github Release](https://github.com/EIT-ALIVE/eitprocessing/actions/workflows/release_github.yml)
on the [Actions](https://github.com/EIT-ALIVE/eitprocessing/actions) tab.
2. On the right hand side, you can select the level increase (patch, minor, or major) and which branch to release from.
- if released from a different branch than `develop`, then the workflow will attempt to merge the changes into develop
as well. If succesfull, the release branch will be deleted from the remote repository.
- [follow semantic versioning conventions](https://semver.org/) to chose the level increase:
2. On the right hand side, you can select the level increase ("patch", "minor", or "major") and which branch to release from.
- [Follow semantic versioning conventions](https://semver.org/) to chose the level increase:
- `patch`: when backward compatible bug fixes were made
- `minor`: when functionality was added in a backward compatible manner
- `major`: when API-incompatible changes have been made
- If the release branch is not `develop`, the workflow will attempt to merge the changes into develop as well. If
succesfull, the release branch will be deleted from the remote repository.
- Note that you cannot release from `main` (the default shown) using the automated workflow. To release from `main`
directly, you must [create the release manually](#manually-create-a-release).
3. Visit [Actions](https://github.com/EIT-ALIVE/eitprocessing/actions) tab to check whether everything went as expected.
4. Navigate to the [Releases](https://github.com/EIT-ALIVE/eitprocessing/releases) tab and click on the newest draft
release that was just generated.
Expand Down
Loading