Skip to content

Commit

Permalink
add github deploy action
Browse files Browse the repository at this point in the history
  • Loading branch information
pgritsch committed Aug 26, 2024
1 parent bf3bca2 commit 3de7c92
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/maven/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">

<servers>
<server>
<id>github</id>
<username>${env.GITHUB_ACTOR}</username> <!-- Automatically uses the GitHub username -->
<password>${env.GITHUB_TOKEN}</password> <!-- Uses the GitHub Actions token for authentication -->
</server>
</servers>
</settings>
31 changes: 31 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish jFaaS:jFaaS:x.y.z to GitHub Packages

on:
workflow_dispatch:
inputs:
version:
description: 'Version of the JAR to publish (e.g., 1.0.0, 1.0.1, etc.)'
required: true
default: '1.0-SNAPSHOT' # Optional, you can set a default version if you want

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'

- name: Create jar file
run: ./gradlew clean build && ./gradlew shadowJar

- name: Deploy JAR to GitHub Packages
run: mvn deploy:deploy-file -Dfile=./build/libs/jFaaS-all.jar -DgroupId=jfaas -DartifactId=jfaas -Dversion=${{ github.event.inputs.version }} -Dpackaging=jar -DrepositoryId=github -Durl=https://maven.pkg.github.com/sashkoristov/jFaaS -DgeneratePom=true -Dmaven.resolver.transport=wagon -e -X
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ publishing {
from(components.java)
}
}

repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/sashkoristov/jFaaS"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

mainClassName = 'jFaaS.Gateway'
Expand Down
File renamed without changes.

0 comments on commit 3de7c92

Please sign in to comment.