|
1 | | -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time |
2 | | -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven |
3 | | - |
4 | 1 | name: Java CI with Maven |
5 | 2 |
|
6 | 3 | on: |
|
9 | 6 | tags: [ "ffmpeg-*" ] |
10 | 7 | pull_request: |
11 | 8 | branches: [ "master" ] |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + skipTests: |
| 12 | + description: 'Skip tests during publish' |
| 13 | + required: false |
| 14 | + default: 'false' |
12 | 15 |
|
13 | 16 | jobs: |
14 | | - build: |
| 17 | + test: |
15 | 18 | runs-on: ubuntu-latest |
16 | | - # Enable debugging to help resolve: |
17 | | - # https://github.com/federicocarboni/setup-ffmpeg/issues/19 |
18 | | - environment: debug |
19 | 19 | strategy: |
20 | 20 | fail-fast: false |
21 | 21 | matrix: |
22 | | - # Long term supported versions |
23 | 22 | java-version: [11, 17, 21] |
24 | 23 |
|
25 | | - # TODO Should we test locales? The old travis setup did, see: |
26 | | - # https://github.com/bramp/ffmpeg-cli-wrapper/pull/55 |
27 | | - |
28 | 24 | name: JDK ${{ matrix.java-version }} |
29 | 25 |
|
30 | 26 | steps: |
31 | | - - uses: actions/checkout@v6 |
32 | | - |
33 | | - - name: Set up FFmpeg |
34 | | - uses: FedericoCarboni/setup-ffmpeg@v3 |
35 | | - id: setup-ffmpeg |
36 | | - with: |
37 | | - ffmpeg-version: release |
38 | | - |
39 | | - - name: Set up JDK ${{ matrix.java-version }} |
40 | | - uses: actions/setup-java@v5 |
41 | | - with: |
42 | | - java-version: ${{ matrix.java-version }} |
43 | | - distribution: 'temurin' |
44 | | - cache: maven |
45 | | - |
46 | | - - name: Compile with Maven |
47 | | - run: mvn --batch-mode --update-snapshots compile |
48 | | - |
49 | | - - name: Test with Maven, Package and Verify with Maven |
50 | | - run: mvn --batch-mode --update-snapshots verify -Dgpg.skip |
51 | | - |
52 | | - # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive |
53 | | - - name: Update dependency graph |
54 | | - uses: advanced-security/maven-dependency-submission-action@v5 |
55 | | - continue-on-error: true |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Set up FFmpeg |
| 30 | + uses: FedericoCarboni/setup-ffmpeg@v3 |
| 31 | + with: |
| 32 | + ffmpeg-version: release |
| 33 | + |
| 34 | + - name: Set up JDK ${{ matrix.java-version }} |
| 35 | + uses: actions/setup-java@v4 |
| 36 | + with: |
| 37 | + java-version: ${{ matrix.java-version }} |
| 38 | + distribution: 'temurin' |
| 39 | + cache: maven |
| 40 | + |
| 41 | + - name: Test with Maven |
| 42 | + run: mvn --batch-mode verify -Dgpg.skip -DskipTests=${{ github.event.inputs.skipTests || 'false' }} |
| 43 | + |
| 44 | + - name: Update dependency graph |
| 45 | + if: matrix.java-version == '21' && github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 46 | + uses: advanced-security/maven-dependency-submission-action@v4 |
| 47 | + continue-on-error: true |
| 48 | + |
| 49 | + publish: |
| 50 | + needs: test |
| 51 | + # Only publish on tags (ffmpeg-*) or manual dispatch |
| 52 | + # and only if it's not a pull request |
| 53 | + if: | |
| 54 | + (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/ffmpeg-')) || |
| 55 | + (github.event_name == 'workflow_dispatch') |
| 56 | + runs-on: ubuntu-latest |
| 57 | + environment: publish |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + |
| 61 | + - name: Set up FFmpeg |
| 62 | + uses: FedericoCarboni/setup-ffmpeg@v3 |
| 63 | + with: |
| 64 | + ffmpeg-version: release |
| 65 | + |
| 66 | + - name: Set up JDK 21 |
| 67 | + uses: actions/setup-java@v4 |
| 68 | + with: |
| 69 | + java-version: '21' |
| 70 | + distribution: 'temurin' |
| 71 | + server-id: central |
| 72 | + server-username: CENTRAL_USERNAME |
| 73 | + server-password: CENTRAL_PASSWORD |
| 74 | + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} |
| 75 | + gpg-passphrase: GPG_PASSPHRASE |
| 76 | + cache: 'maven' |
| 77 | + |
| 78 | + - name: Publish to Sonatype Central Portal |
| 79 | + run: | |
| 80 | + mvn clean deploy \ |
| 81 | + -DskipTests=true \ |
| 82 | + --no-transfer-progress \ |
| 83 | + -P java11plus |
| 84 | + env: |
| 85 | + CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }} |
| 86 | + CENTRAL_PASSWORD: ${{ secrets.CENTRAL_PASSWORD }} |
| 87 | + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
0 commit comments