Skip to content

Compile and Deploy to Maven Repository #38

Compile and Deploy to Maven Repository

Compile and Deploy to Maven Repository #38

Workflow file for this run

name: Compile and Deploy to Maven Repository
on:
workflow_dispatch:
release:
types: [published]
branches: [master]
# push:
# branches: [master]
# pull_request:
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 8
- name: Download BungeeCord Chat Snapshot
run: |
mkdir -p ~/.m2/repository/net/md-5/bungeecord-chat/1.8-SNAPSHOT/
curl -L -o ~/.m2/repository/net/md-5/bungeecord-chat/1.8-SNAPSHOT/bungeecord-chat-1.8-SNAPSHOT.jar https://maven.elmakers.com/repository/net/md-5/bungeecord-chat/1.8-SNAPSHOT/bungeecord-chat-1.8-SNAPSHOT.jar
- name: BuildTools (Spigot 1.8.8)
run: |
mkdir buildtools
cd buildtools
curl -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
java -jar BuildTools.jar --rev 1.8.8
shell: bash
- name: Build with Maven
run: mvn -B clean install
- name: Deploy to Temporary Repository
run: mvn deploy -DaltDeploymentRepository=temp-repo::default::file:./target/maven-repository
- name: Checkout Maven Repository
uses: actions/checkout@v3
with:
repository: AdvancedArmorStands/Repository
token: ${{ secrets.PAT_TOKEN }}
path: maven-repo
- name: Copy Artifacts to Maven Repository
run: |
cp -r target/maven-repository/* maven-repo/
cd maven-repo
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
git commit -m "Deploy artifacts from ${{ github.repository }}@${{ github.sha }}" || exit 0
git push
deploy-only-on-master:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Deploy Complete
run: echo "Artifacts deployed to https://repo.advancedarmorstands.ir/"