Skip to content

Commit

Permalink
test: build as jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
grigoriev committed Aug 2, 2024
1 parent c1f9143 commit 4ce0eb2
Showing 1 changed file with 64 additions and 6 deletions.
70 changes: 64 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ jobs:
java-version: 17
cache: maven
gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }}
- name: Cache Maven
id: cache-maven
uses: actions/cache@v3
with:
path: |
/home/runner/.m2
/home/runner/work/${{ github.repository }}
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: whelk-io/maven-settings-xml-action@9dc09b23833fa9aa7f27b63db287951856f3433d # v22
with:
repositories: >
Expand Down Expand Up @@ -74,21 +84,69 @@ jobs:
- name: Extract artefact version
id: artefact_version
run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT
- name: Print runner name
run: echo "selected runner = ${{ runner.name }}"
outputs:
RUNNER: ${{ runner.name }}
# - uses: actions/cache/save@v3
# name: Save cache
# id: save-cache
# with:
# path: |
# /home/runner/.m2
# /home/runner/work/${{ github.repository }}
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
# restore-keys: |
# ${{ runner.os }}-maven-
maven-central:
needs: build
runs-on: ${{needs.build.outputs.RUNNER}}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
GITHUB_TOKEN: ${{ github.token }}
MARKDOWN2HTML_MAVEN_PLUGIN_FAIL_ON_ERROR: true
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up JDK and Maven
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4
with:
distribution: adopt
java-version: 17
cache: maven
gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }}
- name: Restore Maven cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Publish to Maven Central
# if: ${{ !endsWith(steps.artefact_version.outputs.version, '-SNAPSHOT') && github.ref == 'refs/heads/main' }}
run: mvn --batch-mode -DskipTests=true package # deploy -P gpg-sign -P nexus-staging
github-packages:
needs: build
runs-on: ${{needs.build.outputs.RUNNER}}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
GITHUB_TOKEN: ${{ github.token }}
MARKDOWN2HTML_MAVEN_PLUGIN_FAIL_ON_ERROR: true
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- name: Set up JDK and Maven
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4
with:
distribution: adopt
java-version: 17
cache: maven
gpg-private-key: ${{ secrets.COM_SONATYPE_CENTRAL_POLARION_OPENSOURCE_GPG_PRIVATE_KEY }}
- name: Restore Maven cache
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Publish to GitHub Packages
# if: ${{ !endsWith(steps.artefact_version.outputs.version, '-SNAPSHOT') && github.ref == 'refs/heads/main' }}
run: mvn --batch-mode -DskipTests=true package # deploy -P gpg-sign -P deploy-github-packages

0 comments on commit 4ce0eb2

Please sign in to comment.