diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..82957c0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,24 @@ +name: Publish package to GitHub Packages +on: + release: + types: [published] +jobs: + Publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: 17 + cache: 'gradle' + - name: Grant execute permission to gradlew + run: chmod +x gradlew + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index bb14c06..e2050e8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,8 @@ plugins { - id 'java' - id 'java-library' + id 'java' + id 'java-library' + id 'eclipse' + id 'maven-publish' } archivesBaseName = 'sisaassembler' @@ -18,5 +20,24 @@ java { } test { - useJUnitPlatform() + useJUnitPlatform() } + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifactId = 'sisaassembler' + } + } + repositories { + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/illogicworks/sisaj" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file