Skip to content

Commit

Permalink
Merge pull request #1 from vpa1977/github-publish
Browse files Browse the repository at this point in the history
chore: add github packages publication
  • Loading branch information
vpa1977 authored Oct 18, 2024
2 parents 807b5d8 + 2a9837c commit 49fe36c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to github
on:
workflow_dispatch:

jobs:
build:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 5

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '8'
server-id: central
server-username: ${{ secrets.GITHUB_USERNAME }}
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Setup LXD
uses: canonical/setup-lxd@main
with:
channel: 5.21/candidate

- name: Install rockcraft
run: |
sudo snap install rockcraft --classic
- name: Publish to Github Packages
id: deploy
run: |
./gradlew publish
shell: bash
env:
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: $${ secrets.GITHUB_REPO }}
15 changes: 15 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
allprojects {
version = "0.2.1"
group = "io.github.rockcrafters"
apply(plugin = "maven-publish")
plugins.withType<MavenPublishPlugin>().configureEach {
extensions.configure<PublishingExtension>() {
repositories {
maven {
name = "GitHubPackages"
url = uri(System.getenv("GITHUB_REPO") ?: "")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
}
}

0 comments on commit 49fe36c

Please sign in to comment.