-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (92 loc) · 3.23 KB
/
doc.yaml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Documentation
on:
push:
branches:
- main
- develop
- 'release/*'
tags:
- '*'
pull_request:
branches:
- main
- develop
- 'release/*'
env:
MAIN_REPO: IN-CORE/pyincore-viz
jobs:
# ----------------------------------------------------------------------
# DOCKER BUILD
# ----------------------------------------------------------------------
docker:
runs-on: ubuntu-latest
steps:
# checkout source code
- uses: actions/checkout@v2
# calculate some variables that are used later
- name: version information
run: |
if [ "${{ github.event.release.target_commitish }}" != "" ]; then
BRANCH="${{ github.event.release.target_commitish }}"
elif [[ $GITHUB_REF =~ pull ]]; then
BRANCH="$(echo $GITHUB_REF | sed 's#refs/pull/\([0-9]*\)/merge#PR-\1#')"
else
BRANCH=${GITHUB_REF##*/}
fi
echo "GITHUB_BRANCH=${BRANCH}" >> $GITHUB_ENV
if [ "$BRANCH" == "main" ]; then
version=$(awk -F= '/^release/ { print $2}' docs/source/conf.py | sed "s/[ ']//g")
tags="latest"
oldversion=""
while [ "${oldversion}" != "${version}" ]; do
oldversion="${version}"
tags="${tags},${version}"
version=${version%.*}
done
echo "VERSION=${version}" >> $GITHUB_ENV
echo "TAGS=${tags}" >> $GITHUB_ENV
GA_KEY="${{ secrets.GA_KEY }}"
elif [ "$BRANCH" == "develop" ]; then
echo "VERSION=develop" >> $GITHUB_ENV
echo "TAGS=develop" >> $GITHUB_ENV
GA_KEY="${{ secrets.GA_KEY_DEV }}"
else
echo "VERSION=testing" >> $GITHUB_ENV
echo "TAGS=${BRANCH}" >> $GITHUB_ENV
GA_KEY="${{ secrets.GA_KEY_DEV }}"
fi
echo "GA_KEY=${GA_KEY}" >> $GITHUB_ENV
echo "GA_KEY is: $GA_KEY"
echo "GA_KEY_DEV in secret is: ${{ secrets.GA_KEY_DEV }}"
echo "GA_KEY in secret is: ${{ secrets.GA_KEY }}"
echo "GA_KEY in process is: $GA_KEY"
echo "GA_KEY in env is: ${{ env.GA_KEY }}"
# print out env.GA_KEY
- name: Print out env.GA_KEY
run: |
echo "GA_KEY is: ${{ env.GA_KEY }}"
# build image
- name: Build image
uses: elgohr/[email protected]
with:
name: incore/doc/pyincore-viz
no_push: true
build-args: |
GA_KEY=${{ env.GA_KEY }}
# this will publish to NCSA
- name: Publish to NCSA Hub
#if: github.event_name != 'pull_request' && github.repository == env.MAIN_REPO
if: github.repository == env.MAIN_REPO
uses: elgohr/[email protected]
env:
BRANCH: ${{ env.GITHUB_BRANCH }}
VERSION: ${{ env.VERSION }}
BUILDNUMBER: ${{ github.run_number }}
GITSHA1: ${{ github.sha }}
with:
registry: hub.ncsa.illinois.edu
name: incore/doc/pyincore-viz
username: ${{ secrets.HUB_USERNAME }}
password: ${{ secrets.HUB_PASSWORD }}
tags: "${{ env.TAGS }}"
buildargs: BRANCH,VERSION,BUILDNUMBER,GITSHA1