Skip to content

Commit 89d202b

Browse files
committed
[install] in archiver.yml reconstruct the full repo name from the triggering tag as github.repository seems to give an empty owner
1 parent f0d8dd6 commit 89d202b

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

.github/workflows/archiver.yml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,26 +61,41 @@ jobs:
6161
echo "Current directory is $(pwd)"
6262
echo "WORKDIR is ${WORKDIR}"
6363
githubref=$${{ github.ref }}
64-
echo "(From github.ref) githubref = ${githubref}"
64+
echo "(From github.ref) githubref = ${githubref}"
6565
tagname=${githubref#/tags/}
66-
echo "(From github.ref) tagname = ${tagname}"
66+
echo "(From github.ref) tagname = ${tagname}"
6767
echo "TAGNAME=${tagname}" >> $GITHUB_ENV
68-
###REPO=$${{ github.repository }}
69-
###echo "REPO is ${REPO}" # owner is empty???
70-
###OWNER=${REPO%/*}
71-
###echo "OWNER is ${OWNER}" # owner is empty???
72-
###TAGPREFIX=cudacpp_for
73-
###if [ "${OWNER}" != "madgraph5" ]; then TAGPREFIX="${OWNER}_${TAGPREFIX}"; fi # TEMPORARY! this will change eventually...
68+
REPOSITORY=$${{ github.repository }}
69+
echo "(From github.repository) REPOSITORY = ${REPOSITORY}"
70+
###REPOOWNER=${REPOSITORY%/*} # owner is empty??
71+
REPONAME=${REPOSITORY#*/} # owner is empty??
72+
echo "(From github.repository) REPONAME = ${REPONAME}"
7473
tmpsuffix=${tagname#*cudacpp_for}
7574
TAGPREFIX=${tagname/${tmpsuffix}} # determine TAGPREFIX from triggering tag because github.repository_owner is empty(???)
76-
echo "TAGPREFIX is ${TAGPREFIX}"
75+
echo "(From tagname) TAGPREFIX = ${TAGPREFIX}"
76+
REPOOWNER=${TAGPREFIX%cudacpp_for}
77+
if [ "${REPOOWNER}" == "${TAGPREFIX}" ]; then
78+
echo "INTERNAL ERROR! Invalid TAGPREFIX '${TAGPREFIX}'" # does not end in 'cudacpp_for'?
79+
exit 1
80+
elif [ "${REPOOWNER}" == "" ]; then
81+
REPOOWNER=madgraph5 # TEMPORARY! Will change eventually...
82+
elif [ "${REPOOWNER%_}" != "${REPOOWNER}" ]; then
83+
REPOOWNER=${REPOOWNER%_}
84+
else
85+
echo "INTERNAL ERROR! Invalid REPOOWNER '${REPOOWNER}'" # empty or does not end in '-'?
86+
exit 1
87+
fi
88+
echo "(From tagname) REPOOWNER = ${REPOOWNER}"
89+
REPOSITORY=${REPOOWNER}/${REPONAME}
90+
echo "(From tagname) REPOSITORY = ${REPOSITORY}"
91+
echo "REPOSITORY=${REPOSITORY}" >> $GITHUB_ENV
7792
# Check version tag
7893
cudacpp_version=$(cat ${WORKDIR}/VERSION.txt | awk '/^cudacpp_version/{print $3}')
7994
mg5_version=$(cat ${WORKDIR}/VERSION.txt | awk '/^mg5_version_current/{print $3}')
80-
echo "(From VERSION.txt) cudacpp_version = ${cudacpp_version}"
81-
echo "(From VERSION.txt) mg5_version_current = ${mg5_version}"
95+
echo "(From VERSION.txt) cudacpp_version = ${cudacpp_version}"
96+
echo "(From VERSION.txt) mg5_version_current = ${mg5_version}"
8297
tagname_version=${TAGPREFIX}${mg5_version}_v${cudacpp_version}
83-
echo "(From VERSION.txt) _expected_ tagname = ${tagname_version}[_...]"
98+
echo "(From VERSION.txt) supported tagname = ${tagname_version}[_...]"
8499
if [ "${tagname/${tagname_version}}" == "${tagname}" ]; then
85100
echo "ERROR! Invalid tagname '${tagname}' does not start with '${tagname_version}'"
86101
exit 1 # this will cause the job to fail without running the next steps
@@ -154,11 +169,11 @@ jobs:
154169
echo "Current directory is now $(pwd)"
155170
echo "Current branch is \"$(git branch | \grep ^* | sed 's/^* //')\""
156171
tagname=${TAGNAME}
157-
echo "(From GITHUB_ENV) tagname = ${tagname}"
172+
echo "(From GITHUB_ENV) tagname = ${tagname}"
158173
tagname_latest=${TAGNAME_LATEST}
159-
echo "(From GITHUB_ENV) tagname_latest = ${tagname_latest}"
174+
echo "(From GITHUB_ENV) tagname_latest = ${tagname_latest}"
160175
commit=$(cat ${WORKDIR}/VERSION.txt | awk '/^commit/{print $2}')
161-
echo "(From VERSION.txt) commit = ${commit}"
176+
echo "(From VERSION.txt) commit = ${commit}"
162177
# Create running tag
163178
git config user.name github-actions
164179
git config user.email github-actions@github.com
@@ -209,9 +224,8 @@ jobs:
209224
cd branch_PR
210225
echo "Current directory is now $(pwd)"
211226
echo "Current branch is \"$(git branch | \grep ^* | sed 's/^* //')\""
212-
REPO=$${{ github.repository }}
213-
echo "REPO is ${REPO}"
214-
python3 .github/workflows/archiver.py ${REPO} version_info.dat
227+
echo "(From GITHUB_ENV) REPOSITORY = ${REPOSITORY}"
228+
python3 .github/workflows/archiver.py ${REPOSITORY} version_info.dat
215229
mv version_info.dat ${WORKDIR}
216230
echo "Created version_info.dat"
217231
python3 -c 'print("-"*132)'

0 commit comments

Comments
 (0)