A minor major update #315
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
# Phinner - легенда. | |
# (C) Дарк, 2023 год до н. э. | |
name: Build | |
on: [push, pull_request, workflow_dispatch] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
# Only run on PRs if the source branch is on someone else's repo | |
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: 'oracle' | |
cache: 'gradle' | |
- name: Build Artifact | |
run: ./gradlew jar | |
- name: Upload Artifact to Actions | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ github.event.repository.name }} | |
path: build/libs/ | |
- name: Get New Release Tag | |
id: new-release-tag | |
run: | | |
tag=$(cat src/main/resources/plugin.json | grep "version*" | cut -d ":" -f 2,3 | tr -d \"," ") | |
echo '::set-output name=tag::'$tag | |
- name: Check Release Tag | |
id: check-release-tag | |
uses: mukunku/[email protected] | |
with: | |
tag: ${{ steps.new-release-tag.outputs.tag }} | |
- name: Create Release | |
id: create-release | |
if: ${{ steps.check-release-tag.outputs.exists == 'false' }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.new-release-tag.outputs.tag }} | |
release_name: Release ${{ steps.new-release-tag.outputs.tag }} | |
- name: Upload Release Assets | |
id: upload-release-assets | |
if: ${{ steps.check-release-tag.outputs.exists == 'false' }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create-release.outputs.upload_url }} | |
asset_path: ./build/libs/DarkdustryPlugin-${{ steps.new-release-tag.outputs.tag }}.jar | |
asset_name: DarkdustryPlugin-${{ steps.new-release-tag.outputs.tag }}.jar | |
asset_content_type: application/java-archive |