22
22
workflow_dispatch :
23
23
inputs :
24
24
version :
25
- description : ' Version tag (e.g."v5.0.0-14 ")'
26
- default : " v5.0.0-19 "
25
+ description : ' Version tag (e.g."v5.1.6 ")'
26
+ default : " nightly "
27
27
required : false
28
28
concurrency :
29
29
group : run-once
30
30
cancel-in-progress : false
31
31
permissions :
32
32
contents : read
33
+
33
34
jobs :
34
35
build :
35
- if : github.repository_owner == 'GluuFederation'
36
+ permissions :
37
+ contents : write # for Git to git push
38
+ if : github.repository == 'GluuFederation/flex'
36
39
name : Deploy docs
37
40
runs-on : ubuntu-latest
38
41
steps :
42
+ - name : Harden Runner
43
+ uses : step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v2.7.1
44
+ with :
45
+ egress-policy : audit
46
+
39
47
- name : Checkout
40
- uses : actions/checkout@v3
48
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
41
49
with :
42
50
fetch-depth : 0
43
51
token : ${{ secrets.MOWORKFLOWTOKEN }}
44
52
45
53
- name : Set up Python 3.10
46
- uses : actions/setup-python@v4
54
+ uses : actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
47
55
with :
48
56
python-version : " 3.10"
49
57
cache : pip
57
65
- name : Checkout flex ${{ github.event.inputs.version }}
58
66
if : >-
59
67
github.event_name == 'workflow_dispatch'
60
- uses : actions/checkout@v3
68
+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
61
69
with :
62
70
ref : ' ${{ github.event.inputs.version }}'
63
71
fetch-depth : 0
77
85
78
86
- name : Import GPG key
79
87
id : import_gpg
80
- uses : crazy-max/ghaction-import-gpg@v5
88
+ uses : crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
81
89
with :
82
90
gpg_private_key : ${{ secrets.MOAUTO_GPG_PRIVATE_KEY }}
83
91
passphrase : ${{ secrets.MOAUTO_GPG_PRIVATE_KEY_PASSPHRASE }}
@@ -94,7 +102,10 @@ jobs:
94
102
- name : Generate docs
95
103
continue-on-error : true
96
104
if : >-
97
- github.event_name != 'pull_request'
105
+ github.event_name == 'release' &&
106
+ github.event.action == 'published' &&
107
+ (!github.event.release.draft) &&
108
+ (startsWith(github.event.release.name, 'v') || github.event.release.name == 'nightly')
98
109
env :
99
110
VERSION : ${{ github.event.release.tag_name }}
100
111
run : |
@@ -133,8 +144,8 @@ jobs:
133
144
if : >-
134
145
github.event_name == 'release' &&
135
146
github.event.action == 'published' &&
136
- startsWith( github.event.release.name, 'v' ) &&
137
- ! github.event.release.draft
147
+ (! github.event.release.draft ) &&
148
+ (startsWith( github.event.release.name, 'v') || github.event.release.name == 'nightly')
138
149
env :
139
150
VERSION : ${{ github.event.release.tag_name }}
140
151
run : |
@@ -145,28 +156,30 @@ jobs:
145
156
# github.event_name != 'workflow_dispatch'
146
157
id : set_versions
147
158
run : |
159
+ GITHUB_EVENT_RELEASE_TAG_NAME="${{ github.event.release.tag_name }}"
148
160
TAGS=$(gh release list -L 1000 -R ${{ github.repository }} | grep -o '^\v.*'| grep -v Draft | cut -f 1 | sed '/-/!{s/$/_/}' | sort -V | sed 's/_$//')
149
161
LATEST=$(echo "${TAGS}" | tail -1)
150
162
STABLE=$(echo "${TAGS}" | grep -v -- "nightly" | tail -1)
163
+ if [[ "$GITHUB_EVENT_RELEASE_TAG_NAME" == 'nightly' ]]; then
164
+ LATEST='nightly'
165
+ fi
151
166
echo "Latest is $LATEST and Stable is $STABLE"
152
167
# remove below two lines after first release
153
168
#LATEST="head"
154
169
#STABLE="head"
155
170
mike alias -u head main
156
171
mike alias -u "${STABLE}" stable
157
172
mike set-default --push stable
158
- echo ::set-output name= LATEST:: ${LATEST}
159
- echo ::set-output name= STABLE:: ${STABLE}
173
+ echo " LATEST= ${LATEST}" >> $GITHUB_OUTPUT
174
+ echo " STABLE= ${STABLE}" >> $GITHUB_OUTPUT
160
175
161
176
# Ensures the current branch is gh-pages,
162
177
# Creates / updates the "stable" and "latest" plain text files with the corresponding versions
163
178
# Commits if the files were changed
164
179
# Finally pushes if there are unpushed commits
165
180
- name : Create version files
166
- if : >-
167
- github.event_name != 'pull_request'
168
- env :
169
- VERSION : ${{ github.event.release.tag_name }}
181
+ # if: >-
182
+ # github.event_name != 'workflow_dispatch'
170
183
run : |
171
184
LATEST=${{ steps.set_versions.outputs.LATEST }}
172
185
STABLE=${{ steps.set_versions.outputs.STABLE }}
@@ -183,8 +196,16 @@ jobs:
183
196
184
197
echo "Replacing release number markers with actual release number"
185
198
cd ${LATEST}
186
- egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/replace-flex-version/${LATEST:1}/g"
187
- egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/replace-jans-version/${LATEST:1}/g"
199
+ if [[ "${LATEST}" == "nightly" ]]; then
200
+ egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/replace-janssen-version-stable/0.0.0-nightly/g"
201
+ egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/replace-janssen-version/0.0.0-nightly/g"
202
+ egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/replace-flex-version-stable/0.0.0-nightly/g
203
+ egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/replace-flex-version/0.0.0-nightly/g"
204
+ egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/v0.0.0-nightly/nightly/g"
205
+ else
206
+ egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/replace-flex-version/${LATEST:1}/g
207
+ egrep -lRZ --exclude=CONTRIBUTING.md . | xargs -0 -l sed -i -e "s/replace-janssen-version/${LATEST:1}/g"
208
+ fi
188
209
git add . && git update-index --refresh
189
210
cd ..
190
211
0 commit comments