Skip to content

artifact .yml

artifact .yml #2

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Maven Advanced(artifactId,version)
on:
push:
branches: [ "maven-advanced" ]
pull_request:
branches: [ "maven-advanced" ]
jobs:
build:
runs-on: ubuntu-latest
outputs:
APP_NAME: ${{ steps.indicate.outputs.artifactId }}
APP_VERSION: ${{ steps.pom-version.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'liberica'
cache: maven
# - name: Build with Maven
# run: cd java && mvn -B package --file pom.xml
- id: indicate
name: some shell indicate
run: |
pwd
ls -alh
ls -alh
whoami
cd java && chmod +x mvnw
echo github.workspace:${{ github.workspace }}
echo github.repository:${{ github.repository }}
echo github.ref:${{ github.ref }}
export APP_NAME=$(cat pom.xml | grep -m 1 "<artifactId>" | sed -n 's/.*<artifactId>\(.*\)<\/artifactId>.*/\1/p')
echo "artifactId=$APP_NAME" >> "$GITHUB_OUTPUT"
- name: get-pom-version
id: pom-version
uses: PERES-Richard/maven-get-version-action@v3.0.0
- name: Print Maven POM project version
run: echo "version = ${{ steps.pom-version.outputs.version }} name=${{ steps.indicate.outputs.artifactId}}"
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
# - name: Update dependency graph
# uses: advanced-security/maven-dependency-submission-action@v4.0.0
# with:
# directory : ${{ github.workspace }}/java
# - run: cd java && mvn --batch-mode --update-snapshots verify
# - run: cd java && mkdir staging && cp target/*.jar staging
# - uses: actions/upload-artifact@v4
# with:
# name: Package
# path: java/staging