Skip to content

Commit 87ecc8a

Browse files
author
Jack Yuan
committed
middle
1 parent 2f88d60 commit 87ecc8a

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

github-actionify.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ process() {
106106
die "Not pom-scijava parent: $parent. Run with -p flag to skip this check."
107107
fi
108108

109-
# Change pom.xml from Travis CI to GitHub Actions
109+
# Change pom.xml from Travis CI to GitHub Action
110110
domain="github.com"
111111
domain=$(grep "travis-ci\.[a-z]*/$repoSlug" pom.xml 2>/dev/null | sed 's/.*\(travis-ci\.[a-z]*\).*/\1/')
112112
grep "Travis CI" pom.xml 2>/dev/null | sed 's/Travis CI/GitHub Actions/'
@@ -220,6 +220,23 @@ EOL
220220
warn "No $varsFile found. GitHub Action will not have any environment variables set!"
221221
fi
222222

223+
# add key/value pairs as env vars to yml file
224+
if [ -f "$varsFile" ]
225+
then
226+
while read p; do
227+
# Skip comments. (Cannot use ${p:0:1} because it's bash-specific.)
228+
case "$p" in
229+
'#'*) continue;;
230+
esac
231+
info "Encrypting ${p%%=*}"
232+
yes | $EXEC travis encrypt --$mode "$p" --add env.global --repo "$repoSlug"
233+
test $? -eq 0 || die "Failed to encrypt variable '$p'"
234+
done <"$varsFile"
235+
$EXEC git commit "$gitactionConfig" -m "GitHub Action: add encrypted environment variables"
236+
else
237+
warn "No $varsFile found. GitHub Action will not have any environment variables set!"
238+
fi
239+
223240
# encrypt GPG keypair
224241
if [ -f "$signingKeySourceFile" ]
225242
then

0 commit comments

Comments
 (0)