|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + - '[0-9]+.[0-9]+.x' |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - '[0-9]+.[0-9]+.x' |
| 12 | + schedule: |
| 13 | + - cron: '0 18 * * *' |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +env: |
| 20 | + MAVEN_OPTS: '-Xmx4G -Xms1G -Djava.security.egd=file:/dev/./urandom' |
| 21 | + MAVEN_CLI_OPTS: '-B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' |
| 22 | + |
| 23 | +jobs: |
| 24 | + incremental-build: |
| 25 | + if: github.event_name == 'pull_request' |
| 26 | + runs-on: ubuntu-latest |
| 27 | + timeout-minutes: 30 |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + |
| 34 | + - name: Set up JDK 17 |
| 35 | + uses: actions/setup-java@v4 |
| 36 | + with: |
| 37 | + java-version: '17' |
| 38 | + distribution: 'temurin' |
| 39 | + cache: maven |
| 40 | + |
| 41 | + - name: Build |
| 42 | + run: mvn clean install $MAVEN_CLI_OPTS -DskipTests |
| 43 | + |
| 44 | + full-build: |
| 45 | + if: github.event_name != 'pull_request' |
| 46 | + runs-on: ubuntu-latest |
| 47 | + timeout-minutes: 30 |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Set up JDK 17 |
| 53 | + uses: actions/setup-java@v4 |
| 54 | + with: |
| 55 | + java-version: '17' |
| 56 | + distribution: 'temurin' |
| 57 | + cache: maven |
| 58 | + |
| 59 | + - name: Build |
| 60 | + run: mvn clean install $MAVEN_CLI_OPTS -DskipTests |
| 61 | + |
| 62 | + deploy: |
| 63 | + needs: full-build |
| 64 | + if: | |
| 65 | + github.event_name != 'pull_request' && |
| 66 | + (github.ref == 'refs/heads/master' || contains(github.ref, '.x')) |
| 67 | + runs-on: ubuntu-latest |
| 68 | + environment: production |
| 69 | + permissions: |
| 70 | + packages: write |
| 71 | + steps: |
| 72 | + - name: Checkout |
| 73 | + uses: actions/checkout@v4 |
| 74 | + |
| 75 | + - name: Set up JDK 17 |
| 76 | + uses: actions/setup-java@v4 |
| 77 | + with: |
| 78 | + java-version: '17' |
| 79 | + distribution: 'temurin' |
| 80 | + cache: maven |
| 81 | + |
| 82 | + - name: Configure Maven settings |
| 83 | + uses: s4u/maven-settings-action@v3.0.0 |
| 84 | + with: |
| 85 | + servers: | |
| 86 | + [{ |
| 87 | + "id": "releases", |
| 88 | + "username": "${{ github.actor }}", |
| 89 | + "password": "${{ secrets.GITHUB_TOKEN }}" |
| 90 | + }, |
| 91 | + { |
| 92 | + "id": "snapshots", |
| 93 | + "username": "${{ github.actor }}", |
| 94 | + "password": "${{ secrets.GITHUB_TOKEN }}" |
| 95 | + }] |
| 96 | +
|
| 97 | + - name: Deploy |
| 98 | + run: | |
| 99 | + mvn deploy $MAVEN_CLI_OPTS \ |
| 100 | + -DskipTests=true \ |
| 101 | + -DretryFailedDeploymentCount=10 \ |
| 102 | + -DaltReleaseDeploymentRepository=releases::https://maven.pkg.github.com/codice/jcodec \ |
| 103 | + -DaltSnapshotDeploymentRepository=snapshots::https://maven.pkg.github.com/codice/jcodec |
0 commit comments