Maven Package #113
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
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path | |
name: Maven Package | |
on: | |
release: | |
types: [created] | |
schedule: | |
- cron: '15 7 * * 1-5' | |
workflow_dispatch: | |
inputs: | |
native: | |
type: choice | |
description: build native | |
options: | |
- T | |
- F | |
required: true | |
default: F | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
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: | |
java-version: '17' | |
distribution: 'corretto' | |
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
settings-path: ${{ github.workspace }} # location for the settings.xml file | |
- name: get inputs | |
run: echo "${{ github.event.inputs.native }} ${{ github.event.inputs.native == 'T' }} ${{ github.event.inputs.native == 'F' }}" | |
- name: Set up Graal VM 17 | |
if: ${{ github.event.inputs.native == 'T' }} | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '17' # for a specific JDK 17; or '17' for the latest JDK 17 | |
distribution: 'graalvm' # New 'distribution' option | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Build native binary | |
if: ${{ github.event.inputs.native == 'T' }} | |
run: mvn -B package -Dmaven.test.skip=true -Pnative --file pom.xml | |
- name: list artefact | |
run: ls -ltr vintage-store/target | |
- name: store artefacts | |
run: mkdir dist && cp vintage-store/target/*.jar dist | |
- name: store native artefacts | |
if: ${{ github.event.inputs.native == 'T' }} | |
run: cp vintage-store/target/*runner dist | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: vintage-store | |
path: dist | |
- name: build site | |
run: mvn -B clean package verify site --file pom.xml | |
- name: copy and assemble site | |
run: | | |
ls -ltra && | |
mkdir mysite && cp -r ./target/site/* mysite && | |
mkdir mysite/customer && cp -r ./customer/target/site/* mysite/customer && | |
mkdir mysite/artist && cp -r ./artist/target/site/* mysite/artist && | |
mkdir mysite/vintage-store && cp -r ./vintage-store/target/site/* mysite/vintage-store | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
with: | |
source: ./mysite | |
destination: ./_site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
# Deployment job | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |