Skip to content

Some tweaks for release (#1) #12

Some tweaks for release (#1)

Some tweaks for release (#1) #12

Workflow file for this run

name: Build
on:
push:
branches: "**"
tags-ignore: [ "**" ]
pull_request:
release:
types: [ released ]
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:
- uses: actions/checkout@v3
- uses: gradle/wrapper-validation-action@v1
- name: "jdk"
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: "setup gradle"
uses: gradle/gradle-build-action@v2
- name: "build"
run: ./gradlew build
- name: "determine status"
run: |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then
echo "STATUS=snapshot" >> $GITHUB_ENV
else
echo "STATUS=release" >> $GITHUB_ENV
fi
- name: "publish snapshot"
if: "${{ env.STATUS != 'release' && github.event_name == 'push' && github.ref == 'refs/heads/master' }}"
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_paperSnapshotsUsername: "${{ secrets.PAPER_REPO_USERNAME }}"
ORG_GRADLE_PROJECT_paperSnapshotsPassword: "${{ secrets.PAPER_REPO_PASSWORD }}"
- name: "publish release"
if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}"
run: ./gradlew publish
env:
ORG_GRADLE_PROJECT_paperUsername: "${{ secrets.PAPER_REPO_USERNAME }}"
ORG_GRADLE_PROJECT_paperPassword: "${{ secrets.PAPER_REPO_PASSWORD }}"