|
1 | | -# GitHub Action for the Maven CLI |
| 1 | +# Maven CLI For GitHub Actions |
2 | 2 |
|
3 | | -The [origin project](https://github.com/LucaFeger/action-maven-cli) creates a Maven action with only JDK 8. But I'm writing java with JDK 11 and in the short future I'll keep using JDK 11. So I have forked the origin repository and add support for JDK 11. |
4 | | - |
5 | | -The GitHub Action for [Maven](https://maven.apache.org/) wraps the Maven CLI to enable Maven commands to be run. This can be used to run every Maven Command. |
| 3 | +The Maven CLI For GitHub Actions wraps the maven cli to enable maven commands to be runned inner GitHub Actions. You can use all the maven commands to do whatever you want. |
6 | 4 |
|
7 | 5 | ## Usage |
8 | 6 |
|
9 | 7 | ```yml |
10 | | -# This is a basic workflow to help you get started with Actions |
11 | | - |
12 | | -name: CI |
| 8 | +name: Run maven test on push |
13 | 9 |
|
14 | | -# Controls when the action will run. Triggers the workflow on push or pull request |
15 | | -# events but only for the master branch |
16 | 10 | on: |
17 | 11 | push: |
18 | 12 | branches: [ master ] |
19 | 13 | pull_request: |
20 | 14 | branches: [ master ] |
21 | 15 |
|
22 | | -# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
23 | 16 | jobs: |
24 | | - # This workflow contains a single job called "build" |
25 | 17 | build: |
26 | | - # The type of runner that the job will run on |
27 | 18 | runs-on: ubuntu-latest |
28 | 19 |
|
29 | | - # Steps represent a sequence of tasks that will be executed as part of the job |
30 | 20 | steps: |
31 | | - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
32 | | - - uses: actions/checkout@v2 |
33 | | - |
34 | | - # Runs a single command using the runners shell |
35 | | - - name: Run a one-line script |
36 | | - run: echo Hello, world! |
| 21 | + - name: 1. Checkout code |
| 22 | + uses: actions/checkout@v2 |
37 | 23 |
|
38 | | - # Runs a set of commands using the runners shell |
39 | | - - name: Run maven script |
40 | | - uses: xlui/action-maven-cli/jdk11@master |
41 | | - id: test |
| 24 | + - name: 2. Run maven test |
| 25 | + uses: xlui/action-maven-cli |
42 | 26 | with: |
43 | 27 | lifecycle: 'clean package test' |
44 | 28 | ``` |
45 | 29 |
|
46 | | -Under the last `jobs.build.steps.name` you can set the value of `uses` to this action. |
| 30 | +You can specify any maven lifecycle at the last part of the file. |
47 | 31 |
|
48 | | -```yml |
49 | | -uses: xlui/action-maven-cli/jdk11@master |
50 | | -``` |
| 32 | +In the above example we customize a lifecycle `clean package test`, the real command GitHub Actions run is: |
51 | 33 |
|
52 | | -or |
| 34 | +```bash |
| 35 | +#!/bin/sh -l |
53 | 36 |
|
54 | | -```yml |
55 | | -uses: xlui/action-maven-cli/jdk8@master |
56 | | -``` |
| 37 | +set -e |
57 | 38 |
|
58 | | -As JDK 11 is the latest LTS JDK, there is a convenient way to use it: |
| 39 | +echo "==========Starting Maven Commands==========" |
59 | 40 |
|
60 | | -```yml |
61 | | -uses: xlui/action-maven-cli@master |
| 41 | +sh -c "mvn clean package test" |
| 42 | +
|
| 43 | +echo "==========Finished Maven Commands==========" |
62 | 44 | ``` |
63 | 45 |
|
| 46 | +Have you noticed the conversion? |
| 47 | + |
64 | 48 | ## License |
65 | 49 |
|
66 | 50 | The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE.md). |
0 commit comments