|
4 | 4 | # |
5 | 5 | # Script for enabling or updating GitHub Action builds for a given repository. |
6 | 6 |
|
| 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 | + |
7 | 12 | #set -e |
8 | 13 |
|
9 | 14 | dir="$(dirname "$0")" |
@@ -101,21 +106,11 @@ process() { |
101 | 106 | die "Not pom-scijava parent: $parent. Run with -p flag to skip this check." |
102 | 107 | fi |
103 | 108 |
|
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" |
109 | 111 | 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>' |
119 | 114 |
|
120 | 115 | # -- GitHub Action sanity checks -- |
121 | 116 |
|
|
145 | 140 | # Add/update the GitHub Action build script. |
146 | 141 | cat >"$tmpFile" <<EOL |
147 | 142 | #!/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 |
150 | 145 | EOL |
151 | 146 | chmod +x "$tmpFile" |
152 | 147 | update "$githactionBuildScript" "GitHub Action: add executable script $gitactionBuildScript" "true" |
|
0 commit comments