Merge pull request #88 from GIScience/fix/artifact-upload-4.8.1 #61
This file contains 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: 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- | |
- 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: | |
RT_USERNAME: ${{ secrets.RT_USERNAME }} | |
RT_PASSWORD: ${{ secrets.RT_PASSWORD }} | |
# 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: | |
RT_USERNAME: ${{ secrets.RT_USERNAME }} | |
RT_PASSWORD: ${{ secrets.RT_PASSWORD }} |