forked from sorceress/EasyAuth
Auto-releasing on version change
This commit is contained in:
parent
25cdfc961c
commit
44bd676f66
|
@ -28,9 +28,9 @@ jobs:
|
|||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
- name: Execute permission for renaming script
|
||||
run: chmod +x ./.github/workflows/renaming.sh
|
||||
- name: Running renaming script
|
||||
run: ./.github/workflows/renaming.sh
|
||||
run: chmod +x ./.github/workflows/main.sh
|
||||
- name: Running main script
|
||||
run: ./.github/workflows/main.sh
|
||||
|
||||
# Artifact upload
|
||||
- name: Uploading artifacts
|
||||
|
@ -39,3 +39,29 @@ jobs:
|
|||
#name: ${{ env.BUILDNAME }}.jar
|
||||
name: UNZIP_ME_${{ env.BUILDNAME }}
|
||||
path: build/libs/${{ env.BUILDNAME }}.jar
|
||||
- name: Create a Release
|
||||
if: ${{ env.SHOULD_PUBLISH }}
|
||||
id: create_release
|
||||
uses: actions/create-release@v1.1.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
# The name of the tag. This should come from the webhook payload, `github.GITHUB_REF` when a user pushes a new tag
|
||||
tag_name: ${{ env.VERSION }}
|
||||
# The name of the release. For example, `Release v1.0.1`
|
||||
release_name: SimpleAuth ${{ env.VERSION }}
|
||||
# Text describing the contents of the tag.
|
||||
body: This release was created automatically, since version was bumped. Should be stable unless I messed up something.
|
||||
- name: Upload a Release Asset
|
||||
if: ${{ env.SHOULD_PUBLISH }}
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
# The URL for uploading assets to the release
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
# The path to the asset you want to upload
|
||||
asset_path: build/libs/${{ env.BUILDNAME }}.jar
|
||||
# The name of the asset you want to upload
|
||||
asset_name: ${{ env.BUILDNAME }}
|
||||
asset_content_type: application/zip
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Setting the variables
|
||||
projectId="$(grep 'archives_base_name' gradle.properties | sed 's/archives_base_name = //g;s/ //g;s/,//g;s/"//g')"
|
||||
version="$(grep 'mod_version' gradle.properties | grep -o '[0-9]*\.[0-9]*\.[0-9]*')"
|
||||
mcVersion="$(grep 'minecraft_version' gradle.properties | sed 's/minecraft_version=//g;s/ //g;s/,//g;s/"//g')"
|
||||
|
||||
cd ./build/libs || exit
|
||||
|
||||
buildName="$projectId-$version-devbuild_$GITHUB_RUN_NUMBER-MC_$mcVersion"
|
||||
|
||||
echo "Build is going to be renamed: $buildName.jar"
|
||||
# Renaming the dev build
|
||||
mv "$projectId-$version-$mcVersion.jar" "$buildName.jar"
|
||||
|
||||
# Setting the buildname for GH actions
|
||||
echo "BUILDNAME=$buildName" >> $GITHUB_ENV
|
||||
echo "PROJECT_ID=$projectId" >> $GITHUB_ENV
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
echo "MC_VERSION=$mcVersion" >> $GITHUB_ENV
|
||||
|
||||
|
||||
# Checks if build is stable (I always bump version when I release stable, uploadable version)
|
||||
latestRelease=$(curl -s "https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest" | grep -oP '"tag_name": "\K(.*)(?=")')
|
||||
echo "Latest release is: $latestRelease"
|
||||
|
||||
|
||||
if [ "$latestRelease" == "$version" ]; then
|
||||
echo "No need to publish release. Not necesarry stable yet."
|
||||
else
|
||||
echo "Hooray! New release!"
|
||||
echo "SHOULD_PUBLISH=true" >> $GITHUB_ENV
|
||||
fi
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Setting the variables
|
||||
projectId="$(grep 'archives_base_name' gradle.properties | sed 's/archives_base_name = //g;s/ //g;s/,//g;s/"//g')"
|
||||
version="$(grep 'mod_version' gradle.properties | grep -o '[0-9]*\.[0-9]*\.[0-9]*')"
|
||||
mcVersion="$(grep 'minecraft_version' gradle.properties | sed 's/minecraft_version=//g;s/ //g;s/,//g;s/"//g')"
|
||||
|
||||
cd ./build/libs || exit
|
||||
|
||||
buildName="$projectId-$version-devbuild_$GITHUB_RUN_NUMBER-MC_$mcVersion"
|
||||
|
||||
echo "Build is going to be renamed: $buildName.jar"
|
||||
# Renaming the dev build
|
||||
mv "$projectId-$version-$mcVersion.jar" "$buildName.jar"
|
||||
|
||||
#Setting the buildname for GH actions
|
||||
echo "::set-env name=BUILDNAME::$buildName"
|
Loading…
Reference in New Issue