Try to fix build.yml #3
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: Server builds | |
on: | |
push: | |
branches: [main] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Give permissions to Gradle | |
run: chmod +x ./gradlew | |
- name: Build with Gradle | |
run: ./gradlew jar | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PolarisCore | |
path: build/libs/PolarisCore**.jar | |
- name: Create Release | |
if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) == github.ref }} | |
run: | | |
jar_file=$(basename build/libs/PolarisCore**.jar) | |
file_name_no_ext="${jar_file%.jar}" | |
formatted_name=$(echo "$file_name_no_ext" | sed 's/-/ /g') | |
commit_count=$(git rev-list --count HEAD) | |
gh release create "${commit_count}" build/libs/PolarisCore**.jar \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${formatted_name}" \ | |
--generate-notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |