Skip to content

Workflow file for this run

name: Publish to GitHub Packages
on:
push:
branches:
- 'ors_4.0'
- 'releases/v4.*'
release:
types: [ published ]
jobs:
publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Maven artifacts
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache node
uses: actions/cache@v2
with:
path: web-bundle/node
key: ${{ runner.os }}-node-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os}}-node-
- name: Cache node_modules
uses: actions/cache@v2
with:
path: web-bundle/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/pom.xml', '**/package.json') }}
restore-keys: |
${{ runner.os}}-node_modules-
- uses: s4u/[email protected]
with:
servers: |
[{
"id": "heigit-nexus-snapshots",
"username": "${{ secrets.NEXUS_USERNAME }}",
"password": "${{ secrets.NEXUS_PASSWORD }}"
}, {
"id": "heigit-nexus-releases",
"username": "${{ secrets.NEXUS_USERNAME }}",
"password": "${{ secrets.NEXUS_PASSWORD }}"
}]
- name: Build and publish package on snapshot
if: github.event_name == 'push' && github.event_name != 'release'
run: |
mvn -B -DskipTests -Pskip-shaded-web-jar -Pskip-tools-jar source:jar deploy
env:
NEXUS_BASE_URL: ${{ vars.NEXUS_BASE_URL }}
# Write a task to publish the package to GitHub Packages when a release is published
- name: Build and publish package on release
if: github.event_name == 'release'
run: |
mvn versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
mvn -B -DskipTests -Pskip-shaded-web-jar -Pskip-tools-jar source:jar deploy
env:
NEXUS_BASE_URL: ${{ vars.NEXUS_BASE_URL }}