Skip to content

Commit

Permalink
Update spigot.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Refrac authored Aug 7, 2024
1 parent 4169653 commit 85816cc
Showing 1 changed file with 20 additions and 42 deletions.
62 changes: 20 additions & 42 deletions .github/workflows/spigot.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,28 @@
name: Build

on:
workflow_dispatch:
push:
branches:
- main
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Prepare Project
uses: actions/checkout@v3
with:
ref: 'main'

- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Build with Maven
run: |
mvn -B install --file ./SimpleStaffChat-Spigot/pom.xml
echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 'Spigot-${{ env.PROJECT_VERSION }}'
release_name: SimpleStaffChat-Spigot ${{ env.PROJECT_VERSION }}
draft: false
prerelease: true

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: './SimpleStaffChat-Spigot/target/SimpleStaffChat-Spigot-${{ env.PROJECT_VERSION }}.jar'
asset_name: 'SimpleStaffChat-Spigot-${{ env.PROJECT_VERSION }}.jar'
asset_content_type: 'application/java-archive'
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Rename JAR with Build Number
run: |
original_jar=$(find SimpleStaffChat-Spigot/target/ -type f -name "SimpleStaffChat-Spigot-*.jar")
new_name=$(echo "$original_jar" | sed "s/SimpleStaffChat-Spigot-\(.*\)\.jar/SimpleStaffChat-Spigot-\1+${{ github.run_number }}.jar/")
mv "$original_jar" "$new_name"
- name: Upload a Build Artifact
uses: actions/[email protected] # https://github.com/actions/upload-artifact/releases
with:
name: Click here to download
path: target/SimpleStaffChat-Spigot-*+${{ github.run_number }}.jar

0 comments on commit 85816cc

Please sign in to comment.