Skip to content

Commit

Permalink
Allow releasing to github packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Nov 22, 2024
1 parent 6e46109 commit 6328c4e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Set version
id: version
run: |
DATE=$(date +'%Y%m%d')
HASH=$(git rev-parse --short HEAD)
echo "VERSION=${DATE}-${HASH}" >> $GITHUB_ENV
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Publish package
run: ./gradlew publish -Pversion=$VERSION
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,16 @@ configure(subprojects) {
from(components["java"])
}
}

repositories {
maven {
name = "GitHubPackages"
setUrl("https://maven.pkg.github.com/FAForever/faf-java-commons")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}

0 comments on commit 6328c4e

Please sign in to comment.