Merge pull request #106 from ndw/docbook-5.2 #4
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
name: build-specs | |
on: push | |
jobs: | |
load_config: | |
runs-on: ubuntu-latest | |
outputs: | |
dbversion: ${{ steps.load.outputs.dbversion }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Load the configuration | |
id: load | |
run: | | |
echo dbversion=`cat gradle.properties \ | |
| grep "^docbookBaseVersion" \ | |
| cut -f2 -d=` >> $GITHUB_OUTPUT | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
needs: load_config | |
env: | |
HAVE_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN != '' }} | |
BRANCH_NAME: ${{ github.ref_name }} | |
DBVERSION: ${{ needs.load_config.outputs.dbversion }} | |
steps: | |
- name: Install dependencies | |
run: sudo apt-get install rsync | |
- name: Checkout the specifications | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Info | |
run: echo Building ${{ env.DBVERSION }} of ${{ env.BRANCH_NAME }} | |
- name: Build specifications | |
run: | | |
./gradlew dist | |
- name: Save the built version | |
run: | | |
mkdir /tmp/dist | |
rsync -ar build/dist/ /tmp/dist/ | |
- name: Checkout gh-pages | |
uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
- name: Update the published versions | |
run: | | |
mkdir -p ./tdg/${{ env.DBVERSION }} | |
rsync -ar --delete /tmp/dist/${{ env.DBVERSION }}/ \ | |
./tdg/${{ env.DBVERSION }}/ | |
mkdir -p ./tdg/publishers/${{ env.DBVERSION }} | |
rsync -ar --delete /tmp/dist/publishers/${{ env.DBVERSION }}/ \ | |
./tdg/publishers/${{ env.DBVERSION }}/ | |
mkdir -p ./tdg/sdocbook/${{ env.DBVERSION }} | |
rsync -ar --delete /tmp/dist/sdocbook/${{ env.DBVERSION }}/ \ | |
./tdg/sdocbook/${{ env.DBVERSION }}/ | |
mkdir -p ./tdg/slides/${{ env.DBVERSION }} | |
rsync -ar --delete /tmp/dist/slides/${{ env.DBVERSION }}/ \ | |
./tdg/slides/${{ env.DBVERSION }}/ | |
mkdir -p ./tdg/website/${{ env.DBVERSION }} | |
rsync -ar --delete /tmp/dist/website/${{ env.DBVERSION }}/ \ | |
./tdg/website/${{ env.DBVERSION }}/ | |
git status | |
- name: Deploy to gh-pages | |
if: ${{ env.HAVE_ACCESS_TOKEN == 'true' && (github.ref_name == 'docbook-5.2') }} | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.ACCESS_TOKEN }} | |
folder: . | |
target-folder: / | |
branch: gh-pages |