Skip to content

Ready to Develop <v0.49.16> #65

Ready to Develop <v0.49.16>

Ready to Develop <v0.49.16> #65

# This workflow updates the MML Maven Repo on push to master
name: Update Maven Repo
on:
push:
branches: [ master ]
paths:
- 'megameklab/src/**'
- 'megameklab/resources/**'
jobs:
update_maven_repo:
runs-on: ${{ matrix.os }}
# Run this job once for each combination in the matrix below.
strategy:
matrix:
os: [ ubuntu-latest ] # For Maven Repository Update running on *nix is sufficient
java-distribution: [ temurin ]
java-version: [ 17 ]
steps:
# Put the MML repo in a subfolder to make updating the Maven repo easier
- uses: actions/checkout@v3
with:
path: megameklab
# Grab the MM repo too
- uses: actions/checkout@v3
with:
repository: MegaMek/megamek
path: megamek
# Setup composite build for MML
# see: https://github.com/MegaMek/megamek/wiki/Working-With-Gradle
- name: Setup Composite Build for MML
working-directory: megameklab
run: |
echo "includeBuild '../megamek'" >settings_local.gradle
# Setup the requested Java Distribution and Version from the matrix
- name: Set up ${{ matrix.java-distribution }} JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
distribution: ${{ matrix.java-distribution }}
java-version: ${{ matrix.java-version }}
# Make sure we can execute the Gradle wrapper
- name: Grant execute permission for gradlew (*nix or MacOS)
working-directory: megameklab
run: chmod +x gradlew
if: runner.os != 'Windows'
# Create the actual maven repo bits with Gradle
- name: Publish Maven Repo with Gradle
working-directory: megameklab
run: ./gradlew publishPublishMMLibraryPublicationToMavenRepository
# Get the current Maven repo contents
- name: Checkout Maven Repo
if: github.repository == 'MegaMek/megameklab'
uses: actions/checkout@v3
with:
repository: MegaMek/mavenrepo
path: mavenrepo
# Create an update
- name: Copy Maven Outputs to Repo
if: github.repository == 'MegaMek/megameklab'
working-directory: megameklab/megameklab/build/mavenrepo/
run: |
cp -r . ../../../../mavenrepo/
# In case we run into an issue, use git status to help us understand what happened.
- name: Inspect git status output
if: github.repository == 'MegaMek/megameklab'
working-directory: mavenrepo
run: |
git status
# Add the changes under the username and email of the user who pushed the code
- name: Commit changes to the Maven Repo
if: github.repository == 'MegaMek/megameklab'
working-directory: mavenrepo
run: |
git add .
git config user.email ${{ github.event.pusher.email }}
git config user.name ${{ github.event.pusher.name }}
git commit -m "MegaMek ${{ github.event.after }}" -m "${{ github.event.compare }}"
# Use an SSH deploy key (with write privs) to update the maven repo
- name: Setup SSH and Push changes to the Maven Repo
if: github.repository == 'MegaMek/megameklab'
working-directory: mavenrepo
run: |
eval "$(ssh-agent -s)"
ssh-add - <<< "${{ secrets.MAVEN_REPO_DEPLOY_KEY }}"
git push "git@github.com:MegaMek/mavenrepo.git" HEAD:master