-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: Grace CI | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
permissions: | ||
contents: read # to fetch code (actions/checkout) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: ['11'] | ||
env: | ||
WORKSPACE: ${{ github.workspace }} | ||
steps: | ||
- name: Checkout repository | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'adopt' | ||
java-version: ${{ matrix.java }} | ||
- name: Run Build | ||
id: build | ||
uses: gradle/gradle-build-action@v3 | ||
with: | ||
arguments: build -x test | ||
publish: | ||
if: github.event_name == 'push' | ||
needs: ["build"] | ||
permissions: | ||
contents: read # to fetch code (actions/checkout) | ||
checks: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'adopt' | ||
java-version: 11 | ||
- name: Generate secring file | ||
env: | ||
SECRING_FILE: ${{ secrets.SECRING_FILE }} | ||
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg | ||
- name: Publish to Sonatype OSSRH | ||
id: publish | ||
uses: gradle/gradle-build-action@v3 | ||
env: | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }} | ||
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} | ||
SECRING_FILE: ${{ secrets.SECRING_FILE }} | ||
with: | ||
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Grace Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
create_draft_release: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
steps: | ||
- name: Create draft release | ||
run: | | ||
gh release create \ | ||
--repo ${{ github.repository }} \ | ||
--title ${{ github.ref_name }} \ | ||
--notes '' \ | ||
--draft \ | ||
${{ github.ref_name }} | ||
release_and_publish: | ||
needs: create_draft_release | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
java: ['11'] | ||
env: | ||
GIT_USER_NAME: rainboyan | ||
GIT_USER_EMAIL: [email protected] | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: gradle/wrapper-validation-action@v2 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'adopt' | ||
java-version: ${{ matrix.java }} | ||
- name: Extract Target Branch | ||
id: extract_branch | ||
run: | | ||
echo "Determining Target Branch" | ||
TARGET_BRANCH=`cat $GITHUB_EVENT_PATH | jq '.release.target_commitish' | sed -e 's/^"\(.*\)"$/\1/g'` | ||
echo $TARGET_BRANCH | ||
echo ::set-output name=value::${TARGET_BRANCH} | ||
- name: Set the current release version | ||
id: release_version | ||
run: echo "release_version=${GITHUB_REF:11}" >> $GITHUB_OUTPUT | ||
- name: Generate secring file | ||
id: secring | ||
env: | ||
SECRING_FILE: ${{ secrets.SECRING_FILE }} | ||
run: echo $SECRING_FILE | base64 -d > ${{ github.workspace }}/secring.gpg | ||
- name: Publish to Sonatype OSSRH | ||
id: publish | ||
if: steps.secring.outcome == 'success' | ||
uses: gradle/gradle-build-action@v3 | ||
env: | ||
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | ||
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | ||
SONATYPE_NEXUS_URL: ${{ secrets.SONATYPE_NEXUS_URL }} | ||
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }} | ||
SECRING_FILE: ${{ secrets.SECRING_FILE }} | ||
with: | ||
arguments: -Psigning.secretKeyRingFile=${{ github.workspace }}/secring.gpg publishToSonatype closeAndReleaseSonatypeStagingRepository |