Skip to content

Auto Release After Build #26

Auto Release After Build

Auto Release After Build #26

Workflow file for this run

name: Auto Release After Build
on:
workflow_run:
workflows: ["Manual Plugin Build"]
types:
- completed
jobs:
release:
runs-on: ubuntu-24.04
steps:
- name: Download build artifact (master)
uses: actions/download-artifact@v4
with:
name: LightningPop-master
path: LightningPop-master
- name: Download build artifact (2b)
uses: actions/download-artifact@v4
with:
name: LightningPop-2b
path: LightningPop-2b
- name: Get and increment latest tag
id: get_tag
run: |
# Fetch all tags
git fetch --tags
# Get the latest tag
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest tag: $latest_tag"
# Remove 'v' prefix and split version into parts
version=${latest_tag#v}
IFS='.' read -r major minor patch <<< "$version"
# Increment patch version by 1
new_patch=$((patch + 1))
new_minor=$minor
new_major=$major
# Check if patch exceeds 9
if [ "$new_patch" -gt 9 ]; then
new_patch=0
new_minor=$((minor + 1))
fi
# Check if minor exceeds 9
if [ "$new_minor" -gt 9 ]; then
new_minor=0
new_major=$((major + 1))
fi
new_tag="v$new_major.$new_minor.$new_patch"
echo "New tag: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_ENV
- name: Create and push new tag
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
git tag ${{ env.new_tag }}
git push https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }} ${{ env.new_tag }}
- name: Create GitHub Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.new_tag }}"
prerelease: false
files: |
LightningPop-master/LightningPop-*.jar
LightningPop-2b/LightningPop-*.jar