Skip to content

Commit

Permalink
ci: Migrate to new publishing flow, allowing for snapshots and releas…
Browse files Browse the repository at this point in the history
…e using actions
  • Loading branch information
SimonIT committed Oct 31, 2024
1 parent 79880af commit d3d8714
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 35 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/build-pullrequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build pull request

on:
pull_request:
branches: [ master ]
permissions:
contents: read

jobs:
build-java:
if: "!contains(github.event.head_commit.message, 'ci skip')"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3.0.0
with:
fetch-depth: 0
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build & test Java code
run: |
./gradlew build
./gradlew test
35 changes: 0 additions & 35 deletions .github/workflows/gradle.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and deploy

on:
push:
branches: [ master ]
release:
types: [ published ]

env:
GRADLE_USER_HOME: .gradle

jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: ./gradlew build
- name: Upload all output libs
uses: actions/upload-artifact@v3.0.0
with:
name: output-libs
path: "*/build/libs"

- name: Snapshot build deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'libgdx'
run: ./gradlew build publish
env:
ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}

- name: Import GPG key
if: github.event_name == 'release' && github.repository_owner == 'libgdx'
id: import_gpg
uses: crazy-max/ghaction-import-gpg@1c6a9e9d3594f2d743f1b1dd7669ab0dfdffa922
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Release build deploy
if: github.event_name == 'release' && github.repository_owner == 'libgdx'
run: ./gradlew build publish -PRELEASE -Psigning.gnupg.keyId=${{ secrets.GPG_KEYID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Psigning.gnupg.keyName=${{ secrets.GPG_KEYID }}
env:
ORG_GRADLE_PROJECT_NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}

0 comments on commit d3d8714

Please sign in to comment.