Compare commits

...

25 Commits
v1 ... main

Author SHA1 Message Date
Andrea Como
6085fd7ec6 Readme improvements 2022-10-30 15:05:06 +01:00
Andrea Como
0112b77b50 Replacing deprecations
* set-output in favor of GITHUB_OUTPUT
* upgrading checkout action to v3 in test
2022-10-30 15:04:59 +01:00
Andrea Como
888fab6ad5 Readme improvement 2022-09-26 23:28:18 +02:00
Andrea Como
2e24eecb9a Now any error in the action is propagated 2022-09-26 23:24:54 +02:00
Andrea Como
d79c662fd0 Echoing in test 2022-09-26 22:37:47 +02:00
Andrea Como
4eb059065c Let it fail 2022-09-26 22:35:00 +02:00
Andrea Como
857b725638 Testing expected name 2022-09-26 22:28:44 +02:00
Andrea Como
6b41e84bb9 Assert on name extracted 2022-09-26 22:25:59 +02:00
Andrea Como
bcdce682dc Using the action in the current branch 2022-09-26 22:20:17 +02:00
Andrea Como
5681a80312
Merge pull request #1 from hpehl/patch-1
Add name as an additional output
2022-09-26 22:03:05 +02:00
Harald Pehl
0ceddd3ac8
Update documentation 2022-09-21 15:20:46 +02:00
Harald Pehl
115a2c0d66
Add name as an additional output 2022-09-21 15:16:14 +02:00
acomo
a1f10eca34 Renaming Action Test in CI 2021-02-21 00:22:55 +01:00
acomo
5eb365bfaf Fixed badge 2021-02-21 00:18:03 +01:00
acomo
0a51be4790 Added badge 2021-02-21 00:17:30 +01:00
acomo
42597014f8 Changed repo name and refs 2021-02-21 00:11:23 +01:00
acomo
dbbcd0397b Full repo path 2021-02-21 00:06:45 +01:00
acomo
7fc7bf9e2d Main not master! 2021-02-21 00:04:58 +01:00
acomo
6ebdcf3e93 Using andreacomo 2021-02-21 00:02:54 +01:00
acomo
a01af88340 Using maven-gav-extractor-github-action in action name 2021-02-21 00:01:40 +01:00
acomo
3f04dc43b8 Using actions in test 2021-02-20 23:59:40 +01:00
acomo
ef895ef230 Merge branch 'main' of https://github.com/andreacomo/maven-gav-extractor-github-action into main 2021-02-20 23:54:43 +01:00
acomo
c82a1560f9 Using explicit action name 2021-02-20 23:54:28 +01:00
Andrea Como
82de62dbe8
readme fix 2021-02-20 23:52:10 +01:00
Andrea Como
109eb1c1df
Fixed action name 2021-02-20 23:42:39 +01:00
3 changed files with 41 additions and 15 deletions

View File

@ -1,4 +1,4 @@
name: Action Test name: CI
on: [push] on: [push]
@ -7,11 +7,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Should extract GAV name: Should extract GAV
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Extract GAV - name: Extract GAV
id: extract id: extract
uses: ./ uses: ./
@ -19,10 +15,16 @@ jobs:
pom-location: ${{ github.workspace }}/.github/test-resources/pom.xml pom-location: ${{ github.workspace }}/.github/test-resources/pom.xml
- name: Assert extracted GAV - name: Assert extracted GAV
run: | 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 wget https://raw.github.com/lehmannro/assert.sh/v1.1/assert.sh
. assert.sh . assert.sh
assert "echo ${{ steps.extract.outputs.group-id }}" "com.codingjam" assert "echo ${{ steps.extract.outputs.group-id }}" "com.codingjam"
assert "echo ${{ steps.extract.outputs.artifact-id }}" "github-action-poc" 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.version }}" "1.0.0-SNAPSHOT"
assert "echo ${{ steps.extract.outputs.name }}" "github-action-poc"
assert_end tests assert_end tests
shell: bash shell: bash

View File

@ -1,13 +1,21 @@
# Maven GAV Extractor *GitHub Action* # Maven GAV Extractor
This action extracts GAV from `pom.xml`, i.e.: ![Maven GAV Extractor](https://github.com/andreacomo/maven-gav-extractor/actions/workflows/test.yml/badge.svg)
This *GitHub Action* extracts GAV from `pom.xml`, i.e.:
* `groupId` * `groupId`
* `artifactId` * `artifactId`
* `version` * `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. 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 ## Prerequirements
This action expects you to have `maven` available in your workflow environment 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 | | `group-id` | Group Id of your project |
| `artifact-id` | Artifact Id of your project | | `artifact-id` | Artifact Id of your project |
| `version` | Version of your project | | `version` | Version of your project |
| `name` | Name of your project, artifact Id if not specified |
## Example usage ## Example usage
@ -38,18 +47,20 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Should extract GAV name: Should extract GAV
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v1 uses: actions/setup-java@v2
with: with:
java-version: 11 java-version: 11
distribution: temurin
- name: Extract GAV - name: Extract GAV
id: extract id: extract
uses: andreacomo/maven-gav-extractor-github-action@v1 uses: andreacomo/maven-gav-extractor@v2
- name: Log GAV - name: Log GAV
run: | run: |
echo ${{ steps.extract.outputs.group-id }} echo ${{ steps.extract.outputs.group-id }}
echo ${{ steps.extract.outputs.artifact-id }} echo ${{ steps.extract.outputs.artifact-id }}
echo ${{ steps.extract.outputs.version }} echo ${{ steps.extract.outputs.version }}
echo ${{ steps.extract.outputs.name }}
shell: bash shell: bash
``` ```

View File

@ -18,13 +18,26 @@ outputs:
version: version:
description: Version description: Version
value: ${{ steps.evaluate.outputs.version }} value: ${{ steps.evaluate.outputs.version }}
name:
description: Name
value: ${{ steps.evaluate.outputs.name }}
runs: runs:
using: 'composite' using: 'composite'
steps: steps:
- id: evaluate - id: evaluate
name: Extract GAV name: Extract GAV
env:
EVALUATE: org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate
run: | 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)" VALUE=$(mvn -f ${{ inputs.pom-location }} $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 "group-id=$VALUE" >> $GITHUB_OUTPUT
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.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 shell: bash