Skip to content

Commit

Permalink
Plugin version is now version id plus short hash (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
shabaz213 authored Nov 19, 2024
1 parent d8426c1 commit 78e1aeb
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions .github/workflows/gradle-cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Gradle CD
name: Create plugin zip and release (CD)

on:
push:
Expand Down Expand Up @@ -26,40 +26,29 @@ jobs:
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Fetch all tags
run: git fetch --tags

- name: Determine next tag version
id: getNextTag
- name: Determine plugin version
id: getPluginVersion
run: |
# Get version from plugin.xml
pluginXmlVersion=$(grep -oP '<identifier .* version="\K[^"]+' src/main/zip/plugin.xml)
echo "pluginXmlVersion is $pluginXmlVersion"
# Get the latest tag
latestTag=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "latestTag is $latestTag"
# Determine next tag
if awk "BEGIN {exit !( $latestTag < $pluginXmlVersion )}"; then
nextTag="$pluginXmlVersion.0"
else
nextTag=$(awk "BEGIN {print $latestTag + 0.1}")
fi
# Get the latest short hash
latestShortHash=$(git rev-parse --short $GITHUB_SHA)
echo "latest short hash is $latestShortHash"
echo "nextTag is $nextTag"
echo "value=$nextTag" >> $GITHUB_OUTPUT
echo "value=$pluginXmlVersion.$latestShortHash" >> $GITHUB_OUTPUT
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

- name: Create plugin zip
run: ./gradlew "-PpluginVersion=${{ steps.getNextTag.outputs.value }}"
run: ./gradlew "-PpluginVersion=${{ steps.getPluginVersion.outputs.value }}"

- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.getNextTag.outputs.value }}
tag_name: ${{ steps.getPluginVersion.outputs.value }}
files: "build/distributions/*.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 78e1aeb

Please sign in to comment.