Skip to content

Commit

Permalink
Refactor release workflow to support beta versions
Browse files Browse the repository at this point in the history
  • Loading branch information
maizied.majumder committed Oct 24, 2024
1 parent 9c09743 commit 6ee5a7f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,23 @@ jobs:
id: attest
with:
subject-path: '${{ github.workspace }}/output'

- name: Tag the release version
id: tag_version
run: |
# Fetch the latest tag, if none found, start with v0.0.0
TAG=$(git tag -l | tail -n 1)
if [ -z "$TAG" ]; then
TAG="v0.0.0"
fi
# Extract the version numbers
VERSION=${TAG//v/}
# Split into an array
IFS='.' read -r -a VERSION_ARRAY <<< "$VERSION"
# Increment the last digit for beta versions
LAST=${VERSION_ARRAY[2]}
NEW_LAST=$((LAST + 1))
NEW_VERSION="v${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.$NEW_LAST-beta"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
git tag $NEW_VERSION
git push origin $NEW_VERSION
29 changes: 14 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ name: Automation to Make Releases

on:
push:
tags:
- 'v*.*.*'
branches:
- "main"
tags:
- 'v*.*.*-beta'

jobs:
create_release:
Expand All @@ -12,27 +14,24 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Download .deb package
uses: actions/download-artifact@v3
with:
name: linpad-deb-package

- name: Get current version
id: get_version
run: |
# Fetch the latest tag
TAG=$(git describe --tags --abbrev=0)
# Extract the version numbers
VERSION=${TAG//v/}
# Split into an array
IFS='.' read -r -a VERSION_ARRAY <<< "$VERSION"
# Increment the last digit for beta versions
LAST=${VERSION_ARRAY[2]}
NEW_LAST=$((LAST + 1))
NEW_VERSION="v${VERSION_ARRAY[0]}.${VERSION_ARRAY[1]}.$NEW_LAST-beta"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_version.outputs.NEW_VERSION }}
name: ${{ steps.get_version.outputs.NEW_VERSION }}
body: "Release of Linpad application version ${{ steps.get_version.outputs.NEW_VERSION }}"
files: output/linpad.deb
tag_name: ${{ env.VERSION }}
name: ${{ env.VERSION }}
body: "Release of Linpad application version ${{ env.VERSION }}"
files: linpad.deb # Adjusted the path to the downloaded artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6ee5a7f

Please sign in to comment.