-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (72 loc) · 3.03 KB
/
ephemeral-branch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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