Skip to content

Commit

Permalink
Add GitHub Actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mahozad committed Feb 12, 2024
1 parent fefb09a commit 564442a
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/check-api.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check library API binary compatibility

on:
push:
branches:
- main

jobs:
check-api-compatibility:
name: Check API compatibility
runs-on: windows-latest
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up a specific Java version
uses: actions/setup-java@v4
with:
distribution: "temurin" # OR adopt OR microsoft OR...
java-version: "17"
- name: Run the check
run: ./gradlew apiCheck
41 changes: 41 additions & 0 deletions .github/workflows/generate-publication.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Generate publication

on:
push:
branches:
- main

jobs:
generate-publication:
name: Generate library publication
# Should be macOS to be able to create iOS variants as well
runs-on: macos-latest
env:
# For information about signing.* properties,
# see comments on signing { ... } block in the library build file
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY_CONTENT_BASE64: ${{ secrets.SIGNING_KEY_CONTENT_BASE64 }}
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up a specific Java version
uses: actions/setup-java@v4
with:
distribution: "temurin" # OR adopt OR microsoft OR...
java-version: "17"
- name: Decode the private GPG key file stored in GitHub secrets
run: echo $SIGNING_KEY_CONTENT_BASE64 | base64 -d > private-key.gpg
- name: Generate publication
run: >
./gradlew publishAllPublicationsToCustomLocalRepository
-Psigning.secretKeyRingFile="../private-key.gpg"
-Psigning.password="$SIGNING_PASSWORD"
-Psigning.keyId="$SIGNING_KEY_ID"
--stacktrace
- name: Store the publication at the bottom of the workflow summary page
uses: actions/upload-artifact@v4
with:
name: resultPublication
path: |
library/build/local-repository/
64 changes: 64 additions & 0 deletions .github/workflows/release-new-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release a new version in maven repositories

on:
push:
tags:
- "v[0-9]+.[0-9]+.*"

jobs:
release-version:
name: Release library version
# Should be macOS to be able to create iOS variants as well
runs-on: macos-latest
env:
# For information about signing.* properties,
# see comments on signing { ... } block in the library build file
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY_CONTENT_BASE64: ${{ secrets.SIGNING_KEY_CONTENT_BASE64 }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: read
packages: write
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Set up a specific Java version
uses: actions/setup-java@v4
with:
distribution: "temurin" # OR adopt OR microsoft OR...
java-version: "17"
- name: Decode the private GPG key file stored in GitHub secrets
run: echo $SIGNING_KEY_CONTENT_BASE64 | base64 -d > private-key.gpg
- name: Release to local repository
id: release-local
run: >
./gradlew publishAllPublicationsToCustomLocalRepository
-Psigning.secretKeyRingFile="../private-key.gpg"
-Psigning.password="$SIGNING_PASSWORD"
-Psigning.keyId="$SIGNING_KEY_ID"
--stacktrace
- name: Release to GitHub Packages
if: always() && steps.release-local.outcome == 'success'
run: >
./gradlew publishAllPublicationsToGitHubPackagesRepository
-Psigning.secretKeyRingFile="../private-key.gpg"
-Psigning.password="$SIGNING_PASSWORD"
-Psigning.keyId="$SIGNING_KEY_ID"
--stacktrace
- name: Release to Maven Central
if: always() && steps.release-local.outcome == 'success'
run: >
./gradlew publishAllPublicationsToMavenCentralRepository
-Psigning.secretKeyRingFile="../private-key.gpg"
-Psigning.password="$SIGNING_PASSWORD"
-Psigning.keyId="$SIGNING_KEY_ID"
--stacktrace
- name: Store the publication at the bottom of the workflow summary page
uses: actions/upload-artifact@v4
with:
name: resultPublication
path: |
library/build/local-repository/

0 comments on commit 564442a

Please sign in to comment.