gha-migration #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| env: | |
| JFROG_USER: ${{ secrets.ARTIFACTORY_AUTH_USER }} | |
| JFROG_PASS: ${{ secrets.ARTIFACTORY_AUTH_TOKEN }} | |
| jobs: | |
| maven-verify: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Copy maven settings | |
| run: | | |
| wget https://raw.githubusercontent.com/entur/ror-maven-settings/master/.m2/settings.xml -O .github/workflows/settings.xml | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: 11 | |
| distribution: liberica | |
| - name: Cache Maven dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| ${{ runner.os }}-maven- | |
| ${{ runner.os }}- | |
| - name: Run maven build | |
| run: mvn verify -s .github/workflows/settings.xml | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4.4.3 | |
| with: | |
| name: build-artifacts | |
| path: target/*.jar | |
| publish-snapshot: | |
| name: Publish snapshot to Maven Central | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| needs: maven-verify | |
| uses: entur/gha-maven-central/.github/workflows/maven-publish.yml@v1 | |
| with: | |
| snapshot: true | |
| push_to_repo: false | |
| java_version: 11 | |
| next_version: "" | |
| secrets: inherit |