Add version comparison #448
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Apollo | |
on: [ push ] | |
jobs: | |
build: | |
# Only run on PRs if the source branch is on someone else's repository. | |
if: "${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}" | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- name: Checkout from GitHub | |
uses: actions/checkout@v3 | |
- name: Configure Google Cloud credentials | |
uses: google-github-actions/auth@v1 | |
with: | |
workload_identity_provider: 'projects/271010089174/locations/global/workloadIdentityPools/github/providers/github-oidc' | |
service_account: '[email protected]' | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "zulu" | |
java-version: 8 | |
- name: Setup BuildTools | |
run: | | |
mkdir ~/buildtools | |
cd ~/buildtools | |
wget https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar -O BuildTools.jar | |
java -jar BuildTools.jar --rev 1.8.8 | |
- name: Gradle Build | |
run: ./gradlew build | |
- name: Determine Version | |
run: echo "VERSION=$(./gradlew properties | awk '/^version:/ { print $2; }')" >> $GITHUB_ENV | |
- name: Determine Status | |
run: | | |
if [ "$(echo $VERSION | grep '\-SNAPSHOT')" ]; then | |
echo "STATUS=snapshot" >> $GITHUB_ENV | |
else | |
echo "STATUS=release" >> $GITHUB_ENV | |
fi | |
- name: Gradle Publish | |
if: "${{ github.ref == 'refs/heads/master' }}" | |
run: ./gradlew publish | |
- name: Gradle Release | |
if: "${{ github.ref == 'refs/heads/master' && env.STATUS == 'release' }}" | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: false | |
prerelease: false | |
name: "Apollo v${{ env.VERSION }}" | |
tag_name: "v${{ env.VERSION }}" | |
generate_release_notes: true | |
files: | | |
bukkit/build/libs/apollo-bukkit-${{ env.VERSION }}.jar | |
bungee/build/libs/apollo-bungee-${{ env.VERSION }}.jar | |
velocity/build/libs/apollo-velocity-${{ env.VERSION }}.jar |