Skip to content

Merge pull request #630 from AAVSO/611-mmrd-fix-docs #23

Merge pull request #630 from AAVSO/611-mmrd-fix-docs

Merge pull request #630 from AAVSO/611-mmrd-fix-docs #23

# This workflow will build a Java project with Ant, create a daily release of the
# bash and win targets, update the grammar railroad diagram navigable from the wiki.
#
# For more information see:
# - https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant
# - https://github.com/AAVSO/VStar/issues/340
name: Snapshot release
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
name: Snapshot release
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: '17'
- name: Create plugin dir
run:
mkdir -p ~/vstar_plugins
- name: Create plugin libs dir
run:
mkdir -p ~/vstar_plugin_libs
- name: Build bash archive
run:
ant -noinput -buildfile build.xml bash
- name: Build win archive
run:
ant -noinput -buildfile build.xml win
- name: Build plugins archive
run: |
cd plugin
ant -noinput -buildfile build.xml aavso
cd ..
- name: Cache Maven repository for rrd-antlr4
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: rrd-antlr4-0.1.2-maven
- name: Generate VeLa grammar railroad diagram
run: |
sudo apt-get update -qq
sudo apt-get install -y maven
git clone --depth 1 https://github.com/bkiers/rrd-antlr4.git /tmp/rrd-antlr4
mvn -q clean package -f /tmp/rrd-antlr4/pom.xml
cd /tmp/rrd-antlr4/target
# rrd-antlr4 uses an older ANTLR4 meta-grammar that doesn't support
# element options (< assoc = right >), so strip them before processing.
sed 's/<[[:space:]]*assoc[[:space:]]*=[[:space:]]*right[[:space:]]*>//' \
"$GITHUB_WORKSPACE/src/org/aavso/tools/vstar/vela/VeLa.g4" > /tmp/VeLa.g4
java -jar rrd-antlr4-0.1.2.jar /tmp/VeLa.g4
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: _site
- name: Publish VeLa grammar diagram to gh-pages
run: |
mkdir -p _site/grammar
cp /tmp/rrd-antlr4/target/output/VeLa/index.html _site/grammar/VeLa.html
- name: Deploy plugins to gh-pages (snapshot)
run: |
mkdir -p _site/plugins/snapshot
unzip -o -q plugin/vstar-plugins.zip -d _site/plugins/snapshot/
- name: Commit and push to gh-pages
working-directory: _site
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
if git diff --cached --quiet; then
echo "No changes to publish."
exit 0
fi
git commit -m "Update VeLa grammar diagram and snapshot plugins"
for i in 1 2 3; do
git pull --rebase origin gh-pages && git push origin gh-pages && break
echo "Push attempt $i failed, retrying in $((i * 5))s..."
sleep $((i * 5))
done
- uses: pyTooling/Actions/releaser@r0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: snapshot
rm: true
files: |
vstar-bash.zip
vstar-win.zip