Skip to content

Merge pull request #111 from eclipseguru/development #76

Merge pull request #111 from eclipseguru/development

Merge pull request #111 from eclipseguru/development #76

name: Xiliary Releng Workflow
on:
push:
branches:
- '!**'
- 'master'
- 'development'
env:
DEPLOY_WORK_DIRECTORY: ${{ fromJSON('["development", ""]')[github.ref == 'refs/heads/master'] }}
jobs:
multi-platform-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macos-latest]
steps:
- run: echo "Building Xiliary Components for ${{ fromJSON('["Testing", "Production"]')[env.DEPLOY_WORK_DIRECTORY == ''] }} Repository Site on Branch '${{ github.ref }}'."
- name: Checkout branch
uses: actions/checkout@v2
- name: Create repository site build directory
if: success() && matrix.os == 'windows-latest'
run: mkdir ~/deployment-work
shell: bash
- name: Clone current version of repository site
if: success() && matrix.os == 'windows-latest'
uses: actions/checkout@v2
with:
repository: fappel/xiliary
ref: gh-pages
path: ./gh-pages
- name: Clear the repository site content
if: success() && matrix.os == 'windows-latest'
run: |
cp -a ./gh-pages/. ~/deployment-work/
cwd=$(pwd)
cd ~/deployment-work/${DEPLOY_WORK_DIRECTORY}
rm -f *.html
rm -rf ./assets
rm -rf ./images
rm -rf ./development
cd $cwd
shell: bash
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
- name: Cache local Maven and P2 repositories
uses: pat-s/always-upload-cache@v2.1.5
with:
path: |
~/.m2/repository
~/.p2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml', '**/*.target') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Download Maven (v3.6.3 - allow http download)
uses: stCarolas/setup-maven@v4.2
with:
maven-version: 3.6.3
- name: Build with Maven (headless with xvfb)
uses: GabrielBB/xvfb-action@v1
with:
run: mvn --batch-mode --update-snapshots -f ${{ github.workspace }}/com.codeaffine.xiliary.releng/pom.xml clean verify
- name: Buffer the updated repository site content
uses: actions/upload-artifact@v2
if: success()
with:
name: repository-site-by-build-${{ env.GITHUB_RUN_NUMBER }}
path: ~/deployment-work/
publish-repository-site:
needs: [multi-platform-build]
runs-on: ubuntu-latest
steps:
- run: echo "Publishing Xiliary ${{ fromJSON('["Test", "Production"]')[env.DEPLOY_WORK_DIRECTORY == ''] }} Repository Site."
- name: Restore the updated repository site content
uses: actions/download-artifact@v2
if: success()
with:
name: repository-site-by-build-${{ env.GITHUB_RUN_NUMBER }}
path: ~/deployment-work/
- name: Commit and push the updated repository site to github pages
run: |
cwd=$(pwd)
cd ~/deployment-work/
git config --global user.name 'Xiliary Deamon'
git config --global user.email 'xiliary-deamon@users.noreply.github.com'
git add -f -A
git commit -m "gh-pages update by xiliary workflow build #${GITHUB_RUN_NUMBER}"
git status
git config --local --remove-section http.https://github.com/
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
git push
cd $cwd
shell: bash