Skip to content

Commit a08e25e

Browse files
committed
ci: merge publish job into test workflow for guaranteed serial execution
1 parent dd7d55a commit a08e25e

2 files changed

Lines changed: 68 additions & 89 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 68 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
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-
41
name: Java CI with Maven
52

63
on:
@@ -9,47 +6,82 @@ on:
96
tags: [ "ffmpeg-*" ]
107
pull_request:
118
branches: [ "master" ]
9+
workflow_dispatch:
10+
inputs:
11+
skipTests:
12+
description: 'Skip tests during publish'
13+
required: false
14+
default: 'false'
1215

1316
jobs:
14-
build:
17+
test:
1518
runs-on: ubuntu-latest
16-
# Enable debugging to help resolve:
17-
# https://github.com/federicocarboni/setup-ffmpeg/issues/19
18-
environment: debug
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
# Long term supported versions
2322
java-version: [11, 17, 21]
2423

25-
# TODO Should we test locales? The old travis setup did, see:
26-
# https://github.com/bramp/ffmpeg-cli-wrapper/pull/55
27-
2824
name: JDK ${{ matrix.java-version }}
2925

3026
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

Comments
 (0)