Deploy Maven Project to GitHub Packages #25
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: Deploy Maven Project to GitHub Packages | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up Java for publishing to GitHub Packages | |
uses: actions/[email protected] | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
- name: Cache Maven packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build with Maven | |
run: | | |
mvn clean install --settings .github/settings.xml | |
- name: Publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |
run: | | |
mvn deploy -s .github/settings.xml |