Skip to content

Commit 2f88d60

Browse files
author
Jack Yuan
committed
,finalize
1 parent d43dc21 commit 2f88d60

3 files changed

Lines changed: 16 additions & 24 deletions

File tree

github-action-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ EOL
8383
ciRepo=${ciURL##*/}
8484
ciPrefix=${ciURL%/*}
8585
ciOrg=${ciPrefix##*/}
86-
git config --get remote.origin.url ################
86+
git config --get remote.origin.url
8787
curl -o pull-request.txt https://api.github.com/repos/$ciOrg/$ciRepo/pulls >/dev/null 2>&1 # Check for pull requests
8888
curl -o secure-env.txt https://api.github.com/orgs/$ciOrg/$ciRepo/secrets >/dev/null 2>&1 # Check for secure env var
8989
if [ ! grep -q "documentation_url" secure-env.txt ]; then

github-actionify.sh

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
#
55
# Script for enabling or updating GitHub Action builds for a given repository.
66

7+
# Environment variables:
8+
# $EXEC - an optional prefix for bash commands (for example, if $EXEC=sudo, then the commands will be run as super user access)
9+
# $@ - all positional parameters
10+
# $0, $1, ... - specific positional parameters for each method
11+
712
#set -e
813

914
dir="$(dirname "$0")"
@@ -101,21 +106,11 @@ process() {
101106
die "Not pom-scijava parent: $parent. Run with -p flag to skip this check."
102107
fi
103108

104-
######################### CHANGE POM.XML??? #########################
105-
# TODO: 2 sed statements to replace the system and the url under <ciManagement> in pom.xml
106-
# <system>GitHub Actions<\system>
107-
# <url>https://github.com/$repoSlug/actions<\url>
108-
# domain: manually assign to github.com and delete the rest
109+
# Change pom.xml from Travis CI to GitHub Actions
110+
domain="github.com"
109111
domain=$(grep "travis-ci\.[a-z]*/$repoSlug" pom.xml 2>/dev/null | sed 's/.*\(travis-ci\.[a-z]*\).*/\1/')
110-
test "$domain" &&
111-
info "Detected domain from pom.xml: $domain" ||
112-
die "No valid ciManagement section in pom.xml. Please add one, then try again."
113-
114-
case $domain in
115-
travis-ci.com) mode=pro;;
116-
travis-ci.org) mode=org;;
117-
*) die "Unsupported domain: $domain";;
118-
esac
112+
grep "Travis CI" pom.xml 2>/dev/null | sed 's/Travis CI/GitHub Actions/'
113+
grep "travis-ci\.[a-z]*/$repoSlug" pom.xml | sed '/travis-ci/c\<url>https://github.com/$repoSlug/actions<\/url>'
119114

120115
# -- GitHub Action sanity checks --
121116

@@ -145,8 +140,8 @@ EOL
145140
# Add/update the GitHub Action build script.
146141
cat >"$tmpFile" <<EOL
147142
#!/bin/sh
148-
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/githun-action-build.sh
149-
sh githun-action-build.sh
143+
curl -fsLO https://raw.githubusercontent.com/scijava/scijava-scripts/master/github-action-build.sh
144+
sh github-action-build.sh
150145
EOL
151146
chmod +x "$tmpFile"
152147
update "$githactionBuildScript" "GitHub Action: add executable script $gitactionBuildScript" "true"

github-javadoc.sh

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ ciURL=$(mvn -q -Denforcer.skip=true -Dexec.executable=echo -Dexec.args='${projec
4141
ciRepo=${ciURL##*/}
4242
ciPrefix=${ciURL%/*}
4343
ciOrg=${ciPrefix##*/}
44+
gitBranch=$(git branch --show-current) # get current branch name
4445
curl -o pull-request.txt https://api.github.com/repos/$ciOrg/$ciRepo/pulls >/dev/null 2>&1 # Check for pull requests
4546
curl -o secure-env.txt https://api.github.com/orgs/$ciOrg/$ciRepo/secrets >/dev/null 2>&1 # Check for secure env var
46-
######################## TODO ########################
4747
if [ grep -q "documentation_url" secure-env.txt \
4848
-a ! grep -q "url" pull-request.txt \
49-
-a "$TRAVIS_BRANCH" = master ]
49+
-a "$gitBranch" = master ]
5050
then
5151
project=$1
5252
openssl_key=$2
@@ -61,8 +61,6 @@ then
6161
cp "$customSettings" "$settingsFile"
6262
else
6363
# NB: Use maven.scijava.org as sole mirror if defined in <repositories>.
64-
# This hopefully avoids intermittent "ReasonPhrase:Forbidden" errors
65-
# when the Travis build pings Maven Central; see travis-ci/travis-ci#6593.
6664
test -f pom.xml && grep -A 2 '<repository>' pom.xml | grep -q 'maven.scijava.org' &&
6765
cat >"$settingsFile" <<EOL
6866
<settings>
@@ -124,12 +122,11 @@ EOL
124122

125123
test "$success" || exit 1
126124

127-
######################## TODO ########################
128-
git commit -m "Update $project javadocs (Travis build $TRAVIS_BUILD_NUMBER)"
125+
git commit -m "Update $project javadocs (GitHub Actions build $WORKFLOW_RUN_NUMBER)" # Env var defined in GitHub Actions yml file
129126
git pull --rebase &&
130127
git push -q origin gh-pages > /dev/null || exit 2
131128

132129
echo "Update complete."
133130
else
134-
echo "Skipping non-canonical branch $TRAVIS_BRANCH"
131+
echo "Skipping non-canonical branch $gitBranch"
135132
fi

0 commit comments

Comments
 (0)