STARCH-610 automate creation of github_pages branch #8
Workflow file for this run
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
# Description | |
# ----------- | |
# This workflow is intended to run anytime there is a push on a `feature` | |
# branch, or when a pull request is opened on a `feature`. Ephemeral branches | |
# follow the format `feature/<some name>`. This workflow is intended to verify build and push API documentation. During workflow execution the branch will | |
# be marked pending to prevent it from being merged. It must also complete successfully for the | |
# job to be marked a success, therefore allowing the branch to be merged. | |
name: Ephemeral Branch | |
on: | |
push: | |
branches: | |
- feature/** | |
workflow_dispatch: | |
env: | |
TZ: America/Indianapolis | |
jobs: | |
verify: | |
if: ( github.event_name == 'workflow_dispatch' || github.event_name == 'push' ) && startsWith(github.ref, 'refs/heads/feature/') | |
name: Build and Verify Feature Branch | |
runs-on: [ Linux ] | |
container: | |
image: registry.docker.iu.edu/eshr-architecture/ess-build:latest | |
credentials: | |
username: ${{ secrets.ESHR_REGISTRY_USERNAME }} | |
password: ${{ secrets.ESHR_REGISTRY_PASSWORD }} | |
volumes: | |
- /opt/actions/cache/m2/repository:/root/.m2/repository | |
steps: | |
- name: Clone GitHub repository | |
uses: actions/checkout@v3 | |
- name: Generate build time configuration | |
env: | |
ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_UNT }} | |
ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_UNT }} | |
ESSBUILD_VAULT_APPROLE_ROLE_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_STG }} | |
ESSBUILD_VAULT_APPROLE_SECRET_ID_STG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_STG }} | |
ESSBUILD_VAULT_APPROLE_ROLE_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_ROLE_ID_REG }} | |
ESSBUILD_VAULT_APPROLE_SECRET_ID_REG: ${{ secrets.ESSBUILD_VAULT_APPROLE_SECRET_ID_REG }} | |
run: | | |
generate_build_properties | |
- name: Compile and Build Javadoc | |
id: compile | |
run: | | |
mvn clean verify -DskipTests -U --batch-mode | |
- name: Verify Test Coverage | |
run: | | |
mvn verify -Dmaven.javadoc.skip --batch-mode | |
- name: Publish Documentation | |
if: steps.compile.outcome == 'success' | |
run: | | |
git config --global --add safe.directory $PWD | |
if (git fetch origin github_pages) | |
then | |
git checkout github_pages | |
else | |
git checkout -b github_pages | |
git push --set-upstream origin github_pages | |
fi | |
git pull | |
rm -rf docs/$GITHUB_REF_NAME | |
mkdir -p docs/$GITHUB_REF_NAME | |
for a in $(find -type d -regex '.*/\(apidocs\|jacoco\(-aggregate\)?\)' | cut -b3- | egrep -v '^docs/') | |
do | |
t=docs/$GITHUB_REF_NAME/${a%%target*} | |
mkdir -p $t | |
mv $a $t | |
done | |
git config user.name eshrastg | |
git config user.email [email protected] | |
git add docs | |
git commit -m "publish $GITHUB_ACTOR $GITHUB_REF_NAME" | |
git push | |