Skip to content

Merge pull request #5 from fortify/auto-doc-updates #13

Merge pull request #5 from fortify/auto-doc-updates

Merge pull request #5 from fortify/auto-doc-updates #13

on:
push:
branches:
- '**'
env:
DIST_DIR: ${{ github.workspace }}/build/dist
name: Build development release
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check-out source code
uses: actions/checkout@v2
- name: Define development release info
if: startsWith(github.ref, 'refs/heads/')
run: |
branch="${GITHUB_REF#refs/heads/}"
tag="dev_${branch//[^a-zA-Z0-9_.-]/.}" # Replace all special characters by a dot
echo DO_BUILD=true >> $GITHUB_ENV # We always want to do a build if we're building a branch
echo BRANCH=${branch} >> $GITHUB_ENV
echo RELEASE_TAG=${tag} >> $GITHUB_ENV
if git ls-remote --exit-code origin refs/tags/${tag} >/dev/null 2>&1; then
echo "Found tag ${tag}, development release will be published"
echo DO_RELEASE=true >> $GITHUB_ENV
else
echo "Tag ${tag} does not exist, no development release will be published"
fi
- name: Build development release
if: env.DO_BUILD
run: ./gradlew dist distThirdParty
- name: Publish build artifacts
if: env.DO_BUILD
uses: actions/upload-artifact@v2
with:
name: build_artifacts
path: ${{ env.DIST_DIR }}
- name: Update development release tag
uses: richardsimko/update-tag@v1
if: env.DO_RELEASE
with:
tag_name: ${{ env.RELEASE_TAG }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create pre-release
if: env.DO_RELEASE
run: |
files=$(find "${{ env.DIST_DIR }}" -type f -printf "%p ")
gh release delete ${{ env.RELEASE_TAG }} -y || true
gh release create ${{ env.RELEASE_TAG }} -p -t "Development Release - ${{ env.BRANCH }} branch" -n 'See `Assets` section below for latest build artifacts' ${files}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}