Skip to content

Commit

Permalink
ci: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Bugs5382 committed Nov 2, 2024
1 parent e388341 commit 4756458
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 72 deletions.
144 changes: 72 additions & 72 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,86 +3,86 @@ on:
workflow_dispatch:
workflow_call:

jobs:
Next_Version:
runs-on: ubuntu-latest
outputs:
next_version: ${{ steps.get_version.outputs.next_version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
jobs:
Next_Version:
runs-on: ubuntu-latest
outputs:
next_version: ${{ steps.get_version.outputs.next_version }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set Up Git
run: |
git fetch --tags
- name: Set Up Git
run: |
git fetch --tags
- name: Get Current Version Tag
id: get_current_tag
run: |
# Find the latest tag in the current branch (main or develop)
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "latest_tag=${latest_tag}" >> $GITHUB_ENV
- name: Get Current Version Tag
id: get_current_tag
run: |
# Find the latest tag in the current branch (main or develop)
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "latest_tag=${latest_tag}" >> $GITHUB_ENV
- name: Determine Next Version
id: get_version
run: |
# Set initial version if no tag found
if [[ -z "$latest_tag" ]]; then
latest_tag="v0.0.0"
fi
- name: Determine Next Version
id: get_version
run: |
# Set initial version if no tag found
if [[ -z "$latest_tag" ]]; then
latest_tag="v0.0.0"
fi
# Extract the version parts
if [[ "$latest_tag" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)(-beta\.[0-9]+)?$ ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
beta="${BASH_REMATCH[4]}"
else
echo "Invalid tag format: $latest_tag"
exit 1
fi
# Extract the version parts
if [[ "$latest_tag" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)(-beta\.[0-9]+)?$ ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
patch="${BASH_REMATCH[3]}"
beta="${BASH_REMATCH[4]}"
else
echo "Invalid tag format: $latest_tag"
exit 1
fi
# Increment the version based on the branch
if [[ "${GITHUB_REF_NAME}" == "main" ]]; then
next_version="v$major.$((minor + 1)).0" # Full release, reset beta
# Increment the version based on the branch
if [[ "${GITHUB_REF_NAME}" == "main" ]]; then
next_version="v$major.$((minor + 1)).0" # Full release, reset beta
else
if [[ -z "$beta" ]]; then
next_version="v$major.$minor.$patch-beta.1" # Start beta versioning
else
if [[ -z "$beta" ]]; then
next_version="v$major.$minor.$patch-beta.1" # Start beta versioning
else
# Increment beta version
beta_number="${beta#*-beta.}"
next_version="v$major.$minor.$patch-beta.$((beta_number + 1))"
fi
# Increment beta version
beta_number="${beta#*-beta.}"
next_version="v$major.$minor.$patch-beta.$((beta_number + 1))"
fi
fi
echo "next_version=${next_version}" >> $GITHUB_ENV
echo "::set-output name=next_version::${next_version}"
echo "next_version=${next_version}" >> $GITHUB_ENV
echo "::set-output name=next_version::${next_version}"
Create:
runs-on: ubuntu-latest
needs: Next_Version
steps:
- name: Checkout code
uses: actions/checkout@v4
Create:
runs-on: ubuntu-latest
needs: Next_Version
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Draft Release (Develop)
if: github.event.pull_request.base.ref == 'develop'
uses: release-drafter/release-drafter@v6
with:
name: "${{ needs.compute-version.outputs.next_version }}"
tag: "${{ needs.compute-version.outputs.next_version }}"
prerelease: true
commitish: develop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Draft Release (Develop)
if: github.event.pull_request.base.ref == 'develop'
uses: release-drafter/release-drafter@v6
with:
name: "${{ needs.compute-version.outputs.next_version }}"
tag: "${{ needs.compute-version.outputs.next_version }}"
prerelease: true
commitish: develop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Draft Release
if: github.event.pull_request.base.ref != 'develop'
uses: release-drafter/release-drafter@v6
with:
name: "${{ needs.compute-version.outputs.next_version }}"
tag: "${{ needs.compute-version.outputs.next_version }}"
prerelease: false
commitish: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Draft Release
if: github.event.pull_request.base.ref != 'develop'
uses: release-drafter/release-drafter@v6
with:
name: "${{ needs.compute-version.outputs.next_version }}"
tag: "${{ needs.compute-version.outputs.next_version }}"
prerelease: false
commitish: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- synchronize

jobs:

Build:
runs-on: ubuntu-latest
strategy:
Expand Down

0 comments on commit 4756458

Please sign in to comment.