mirror of
https://github.com/andreacomo/maven-gav-extractor.git
synced 2025-06-06 11:17:55 +08:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6085fd7ec6 | ||
![]() |
0112b77b50 | ||
![]() |
888fab6ad5 | ||
![]() |
2e24eecb9a | ||
![]() |
d79c662fd0 | ||
![]() |
4eb059065c | ||
![]() |
857b725638 | ||
![]() |
6b41e84bb9 | ||
![]() |
bcdce682dc | ||
![]() |
5681a80312 | ||
![]() |
0ceddd3ac8 | ||
![]() |
115a2c0d66 | ||
![]() |
a1f10eca34 | ||
![]() |
5eb365bfaf | ||
![]() |
0a51be4790 | ||
![]() |
42597014f8 | ||
![]() |
dbbcd0397b | ||
![]() |
7fc7bf9e2d | ||
![]() |
6ebdcf3e93 | ||
![]() |
a01af88340 | ||
![]() |
3f04dc43b8 | ||
![]() |
ef895ef230 | ||
![]() |
c82a1560f9 | ||
![]() |
82de62dbe8 | ||
![]() |
109eb1c1df |
14
.github/workflows/test.yml
vendored
14
.github/workflows/test.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: Action Test
|
||||
name: CI
|
||||
|
||||
on: [push]
|
||||
|
||||
@ -7,11 +7,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Should extract GAV
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- uses: actions/checkout@v3
|
||||
- name: Extract GAV
|
||||
id: extract
|
||||
uses: ./
|
||||
@ -19,10 +15,16 @@ jobs:
|
||||
pom-location: ${{ github.workspace }}/.github/test-resources/pom.xml
|
||||
- name: Assert extracted GAV
|
||||
run: |
|
||||
echo ${{ steps.extract.outputs.group-id }}
|
||||
echo ${{ steps.extract.outputs.artifact-id }}
|
||||
echo ${{ steps.extract.outputs.version }}
|
||||
echo ${{ steps.extract.outputs.name }}
|
||||
|
||||
wget https://raw.github.com/lehmannro/assert.sh/v1.1/assert.sh
|
||||
. assert.sh
|
||||
assert "echo ${{ steps.extract.outputs.group-id }}" "com.codingjam"
|
||||
assert "echo ${{ steps.extract.outputs.artifact-id }}" "github-action-poc"
|
||||
assert "echo ${{ steps.extract.outputs.version }}" "1.0.0-SNAPSHOT"
|
||||
assert "echo ${{ steps.extract.outputs.name }}" "github-action-poc"
|
||||
assert_end tests
|
||||
shell: bash
|
21
README.md
21
README.md
@ -1,13 +1,21 @@
|
||||
# Maven GAV Extractor *GitHub Action*
|
||||
# Maven GAV Extractor
|
||||
|
||||
This action extracts GAV from `pom.xml`, i.e.:
|
||||

|
||||
|
||||
This *GitHub Action* extracts GAV from `pom.xml`, i.e.:
|
||||
|
||||
* `groupId`
|
||||
* `artifactId`
|
||||
* `version`
|
||||
* `name` (as Maven default, get the same value of `artifactId` if not specified)
|
||||
|
||||
Why should I need this? For example, to **name** and **tag** a Docker image built upon your artifact or **pass as parameters** to a dispatched workflow.
|
||||
|
||||
## Versioning
|
||||
This project follows *Semantic Versioning* according to [GitHub Actions versioning practice](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md)
|
||||
|
||||
>Current stable version is `v2`
|
||||
|
||||
## Prerequirements
|
||||
|
||||
This action expects you to have `maven` available in your workflow environment
|
||||
@ -25,6 +33,7 @@ This action expects you to have `maven` available in your workflow environment
|
||||
| `group-id` | Group Id of your project |
|
||||
| `artifact-id` | Artifact Id of your project |
|
||||
| `version` | Version of your project |
|
||||
| `name` | Name of your project, artifact Id if not specified |
|
||||
|
||||
## Example usage
|
||||
|
||||
@ -38,18 +47,20 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Should extract GAV
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
java-version: 11
|
||||
distribution: temurin
|
||||
- name: Extract GAV
|
||||
id: extract
|
||||
uses: andreacomo/maven-gav-extractor-github-action@v1
|
||||
uses: andreacomo/maven-gav-extractor@v2
|
||||
- name: Log GAV
|
||||
run: |
|
||||
echo ${{ steps.extract.outputs.group-id }}
|
||||
echo ${{ steps.extract.outputs.artifact-id }}
|
||||
echo ${{ steps.extract.outputs.version }}
|
||||
echo ${{ steps.extract.outputs.name }}
|
||||
shell: bash
|
||||
```
|
19
action.yml
19
action.yml
@ -18,13 +18,26 @@ outputs:
|
||||
version:
|
||||
description: Version
|
||||
value: ${{ steps.evaluate.outputs.version }}
|
||||
name:
|
||||
description: Name
|
||||
value: ${{ steps.evaluate.outputs.name }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- id: evaluate
|
||||
name: Extract GAV
|
||||
env:
|
||||
EVALUATE: org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate
|
||||
run: |
|
||||
echo "::set-output name=group-id::$(mvn -f ${{ inputs.pom-location }} org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.groupId -q -DforceStdout)"
|
||||
echo "::set-output name=artifact-id::$(mvn -f ${{ inputs.pom-location }} org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId -q -DforceStdout)"
|
||||
echo "::set-output name=version::$(mvn -f ${{ inputs.pom-location }} org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout)"
|
||||
VALUE=$(mvn -f ${{ inputs.pom-location }} $EVALUATE -Dexpression=project.groupId -q -DforceStdout)
|
||||
echo "group-id=$VALUE" >> $GITHUB_OUTPUT
|
||||
|
||||
VALUE=$(mvn -f ${{ inputs.pom-location }} $EVALUATE -Dexpression=project.artifactId -q -DforceStdout)
|
||||
echo "artifact-id=$VALUE" >> $GITHUB_OUTPUT
|
||||
|
||||
VALUE=$(mvn -f ${{ inputs.pom-location }} $EVALUATE -Dexpression=project.version -q -DforceStdout)
|
||||
echo "version=$VALUE" >> $GITHUB_OUTPUT
|
||||
|
||||
VALUE=$(mvn -f ${{ inputs.pom-location }} $EVALUATE -Dexpression=project.name -q -DforceStdout)
|
||||
echo "name=$VALUE" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
Loading…
x
Reference in New Issue
Block a user