Skip to content

Commit

Permalink
Fix the workflow (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
hiwakaba authored Nov 13, 2024
1 parent b2a27fc commit 3ebe33a
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 98 deletions.
102 changes: 54 additions & 48 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,59 +27,65 @@ jobs:

name: Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v4
- name: Setup Java JDK
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
server-id: ossrh
settings-path: ${{ github.workspace }}
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable of GPG private key passphrase
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}

- name: Set environments
run: |
echo "COMMON_MAVEN_OPTS=-Dmaven.compiler.failOnWarning=true -Dmaven.compiler.showDeprecation=true -Dmaven.compiler.verbose=true -Dmaven.compiler.debuglevel=lines,vars,source" >> "$GITHUB_ENV"
- name: Set environments
run: |
echo "COMMON_MAVEN_OPTS=-Dmaven.compiler.failOnWarning=true -Dmaven.compiler.showDeprecation=true -Dmaven.compiler.verbose=true -Dmaven.compiler.debuglevel=lines,vars,source" >> "$GITHUB_ENV"
- name: Install dependent packages
run: |
sudo apt-get install -y curl
curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh | sudo bash
sudo apt-get install -y k2hash-dev
- name: Install dependent packages
run: |
sudo apt-get install -y curl
curl -s https://packagecloud.io/install/repositories/antpickax/stable/script.deb.sh | sudo bash
sudo apt-get install -y k2hash-dev
- name: Run checkstyle
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} checkstyle:check
- name: Run checkstyle
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} checkstyle:check
- name: Run package on version 8
if: "matrix.java == '8'"
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} -Dmaven.compiler.target=8 package
- name: Run package on version 8
if: "matrix.java == '8'"
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} -Dmaven.compiler.target=8 package
- name: Run package on version other than 8
if: "matrix.java != '8'"
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} -Dmaven.compiler.target=${{ matrix.java }} -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.release=${{ matrix.java }} package
- name: Run package on version other than 8
if: "matrix.java != '8'"
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} -Dmaven.compiler.target=${{ matrix.java }} -Dmaven.compiler.source=${{ matrix.java }} -Dmaven.compiler.release=${{ matrix.java }} package
- name: Run javadoc
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} javadoc:javadoc
- name: Run javadoc
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} javadoc:javadoc
- name: Deploy the docs to github
if: "github.event_name == 'release' && matrix.java == '21'"
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} site -s settings_github.xml
env:
GITPAGES_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKE_FOR_GITPAGES }}
- name: Deploy the docs to github
if: "github.event_name == 'release' && matrix.java == '21'"
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} site
env:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password

- name: Set up Apache Maven Central
uses: actions/setup-java@v4
with: # running setup-java again overwrites the settings.xml
distribution: 'zulu'
java-version: ${{ matrix.java }}
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Publish to Apache Maven Central
if: "github.event_name == 'release' && matrix.java == '21'"
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} deploy -Prelease
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Publish to Apache Maven Central
if: "github.event_name == 'release' && matrix.java == '21'"
run: |
mvn ${{ env.COMMON_MAVEN_OPTS }} deploy -Prelease -s $GITHUB_WORKSPACE/settings.xml
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
50 changes: 0 additions & 50 deletions settings_github.xml

This file was deleted.

0 comments on commit 3ebe33a

Please sign in to comment.