Finalization tryout...
All checks were successful
/ GenerateReleaseZipfile (push) Successful in 1m13s

This commit is contained in:
Chl 2024-08-31 01:47:16 +02:00
parent 31cfa7d900
commit 917b4170ee
2 changed files with 19 additions and 11 deletions

View file

@ -4,8 +4,8 @@ on:
jobs:
GenerateReleaseZipfile:
runs-on: ubuntu-latest
# To allow access to the artifact with the GITHUB_TOKEN at the last step
permissions: read-all
# Trying to help access to the artifact with the GITHUB_TOKEN at the last step but didn't help.
#permissions: read-all
steps:
- name: Generate some content
run: |
@ -18,6 +18,7 @@ jobs:
echo tutu >> tutu.txt
echo tutuuuuu >> tutu2.txt
echo tutuuuuu >> "tutu tutu.txt"
# Github doesn't like special characters.
#echo ratata >> 'tutu tutu*.txt'
ls -R
@ -36,6 +37,7 @@ jobs:
- name: Testing the artifact uploading
id: "uploading"
uses: ./myaction
# For comparison
#uses: actions/upload-artifact@v4
with:
path: |
@ -45,7 +47,7 @@ jobs:
- name: "Cleanup Github"
run: rm -rvf myaction
- name: Is there any output for the previous step ?
- name: Is there any output for the uploading step ?
run: |
set -x
printf "steps.uploading.outputs.artifact-id: %s\n" "${{ steps.uploading.outputs.artifact-id }}"
@ -79,10 +81,13 @@ jobs:
# - ...but we get redirect to Windows.net/Azure data warehouse which refuses GITHUB_TOKEN...
# -> so, if the api.github.com fails, we try to extract the redirect location and hit it without any header.
# ('beginning to wonder if Github's changing master to main was also a part of a plot to complexify our lives...)
TMP_WGET_OUTPUT="$( mktemp )"
wget -O "$DOWNLOAD_FILE" --header "Authorization: Bearer $GITHUB_TOKEN" "https://api.github.com/repos/$GITHUB_REPOSITORY/actions/artifacts/${{ steps.uploading.outputs.artifact-id }}/zip" 2>"$TMP_WGET_OUTPUT" || (
wget -O "$DOWNLOAD_FILE" "$( sed -n 's/^Location: \(.*\) \[following\]/\1/p' "$TMP_WGET_OUTPUT" | tail -n 1 )"
)
WGET_OUTPUT="$( wget -O "$DOWNLOAD_FILE" \
--header "Authorization: Bearer $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/artifacts/${{ steps.uploading.outputs.artifact-id }}/zip" 2>&1 )" \
|| wget -O "$DOWNLOAD_FILE" \
"$( echo "$WGET_OUTPUT" | sed -n 's/^Location: \(.*\) \[following\]/\1/p' | tail -n 1 )"
# unzip and check
unzip "$DOWNLOAD_FILE"
sha256sum -c "$SHASUM_FILE"