Merge pull request #1298 from Sleet01/fix-1230-fixed-wing-transport-d… #290
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
# 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 "[email protected]:MegaMek/mavenrepo.git" HEAD:master |