Multiverse-Core/.github/workflows/publish.yml
2023-02-19 23:24:44 -05:00

48 lines
1.3 KiB
YAML

name: Publish package to GitHub Packages
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
cache: gradle
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Publish package
uses: gradle/gradle-build-action@v2
with:
arguments: publish
env:
GITHUB_VERSION: ${{ steps.get_release.outputs.tag }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: build/libs/Multiverse-Core-${{ steps.get_release.outputs.tag }}.jar
asset_name: Multiverse-Core-${{ steps.get_release.outputs.tag }}.jar
asset_content_type: application/java-archive