blob: e2eeb2a902608e6f8869524fb2b75d3208b90d0e [file] [log] [blame] [raw]
name: Dev Build
on:
push:
branches: [dev, '1.12']
paths:
- .github/workflows/**
- etc/checkstyle.xml
- src/**
- pom.xml
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [16]
name: Dev Build (Java ${{ matrix.java }})
steps:
- uses: actions/checkout@v2
- name: Set up Maven
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
server-id: glowstone-upstream
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Cache
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache Maven
run: mvn -T 1C -B dependency:go-offline
- name: Publish to Maven
run: mvn -Dmaven.test.skip=true -T 1C -B source:jar javadoc:jar deploy -Pbuild-extras
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
JAVA_TOOL_OPTIONS: -Xmx2G
- name: Push Javadocs to Pages
uses: dmnemec/copy_file_to_another_repo_action@v1.1.1
env:
API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN }}
with:
source_file: 'target/apidocs/.'
destination_repo: 'GlowstoneMC/glowstonemc.github.io'
destination_folder: 'content/jd/glowstone/1.16/' # TODO: detect version?
user_email: 'mastercoms@tuta.io'
user_name: 'mastercoms'
commit_message: Update Javadocs for Glowstone commit ${{ github.sha }}
- name: GitHub Artifact
uses: actions/upload-artifact@v2
with:
name: glowstone
path: target/glowstone.jar
- name: Setup SSH
if: ${{ github.ref == 'refs/heads/1.12' }}
run: |
mkdir -p ~/.ssh
cat << EOF > ~/.ssh/config
Host *
ControlMaster auto
ControlPath ~/.ssh/-%r@%h:%p
ControlPersist 120
EOF
echo $SSH_KNOWN_HOSTS >> ~/.ssh/known_hosts
sudo apt-get install sshpass
env:
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Deploy to Test Server
if: ${{ github.ref == 'refs/heads/1.12' }}
run: |
sshpass -e scp target/glowstone.jar glowstone@$SSH_ADDRESS:
sshpass -e ssh glowstone@$SSH_ADDRESS sudo systemctl restart glowstone
env:
SSH_ADDRESS: ${{ secrets.SSH_ADDRESS }}
SSHPASS: ${{ secrets.SSH_PASSWORD }}