Skip to content

Commit

Permalink
MARP-1053 Update release drafter workflows for branch master
Browse files Browse the repository at this point in the history
  • Loading branch information
lttung-axonivy committed Jan 15, 2025
1 parent 76b09e6 commit 4ac5c28
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 30 deletions.
67 changes: 37 additions & 30 deletions .github/workflows/publish-release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,43 @@
name: Publish Release Drafter

on:
workflow_run:
workflows: ["Release-Build"]
types:
- completed
workflow_dispatch:
inputs:
tag:
required: true
type: string

env:
COMMITISH: master

jobs:
publish_release_drafter:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: axonivy-market/github-workflows/.github/workflows/publish-release-drafter.yml@v5
# The following input parameters are available:
#
# - tag: (optional) Specifies the release tag (e.g., 'v10.0.0').
# If not provided, the most recent tag in the repository will be used by default.
# This ensures the workflow runs without requiring explicit tag input.
#
# - commitish: (optional) Indicates the branch name for the release.
# If not provided, it defaults to 'master'. For versioned releases,
# the workflow automatically checks for a corresponding branch
# (e.g., 'release/10.0' for version 10.0) and uses it if available.
# This allows the workflow to execute with default branch behavior.
#
# - publish: (optional) Controls whether the release is published automatically.
# Defaults to 'true'. Set to 'false' to create a draft release
# without immediate publication.
#
# Note: Both 'tag' and 'commitish' are configured to run with sensible defaults,
# so manual input is not required unless custom values are needed.
#
# Uncomment and modify the inputs as needed:
# with:
# tag: v10.0.0
# commitish: release/10.0
# publish: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Configure Release Draft Settings
run: |
VERSION_NUMBER=$(echo "${{inputs.tag}}" | sed -E 's/^([0-9]+\.[0-9]+)\..*/\1/')
echo $(git branch -r | grep "origin/release/$VERSION_NUMBER")
# Check if the branch for this version exists and set COMMITISH
if [[ $(git branch -r | grep "origin/release/$VERSION_NUMBER") ]]; then
echo "COMMITISH=release/$VERSION_NUMBER" >> $GITHUB_ENV
else
echo "COMMITISH=master" >> $GITHUB_ENV
fi
- name: Use Release Drafter
uses: release-drafter/release-drafter@v6
with:
disable-autolabeler: true
name: ${{inputs.tag}} 🛒
tag: ${{inputs.tag}}
version: ${{inputs.tag}}
commitish: ${{ env.COMMITISH }}
latest: ${{ env.COMMITISH == 'master' }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ on:
- release/*
pull_request:
types: [opened, reopened, synchronize]
workflow_dispatch:

jobs:
release_drafter:
if: ${{ github.ref_name == 'master' || startsWith(github.ref_name, 'release/') }}
uses: axonivy-market/github-workflows/.github/workflows/release-drafter.yml@v5

0 comments on commit 4ac5c28

Please sign in to comment.