From 6f1886f35514ea32f6ba56f1d95452d36ba39638 Mon Sep 17 00:00:00 2001 From: Yuri Goldfeld Date: Wed, 17 Jan 2024 21:16:34 -0800 Subject: [PATCH 1/8] (experimental) --- .github/workflows/main.yml | 68 +++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5d8a15f7d..d524ba0c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1013,6 +1013,66 @@ jobs: with: submodules: true + + + + # XXX + + + - name: (On release creation only) Prepare full source package(s) to attach to Release + id: prep_release_pkgsXXX + if: success() + # XXX && (!cancelled()) && startsWith(github.ref, 'refs/tags/v') + run: | + # Prepare full source package(s) to attach to Release. + cd ${{ github.workspace }}/.. + REPO=ipc + # XXX VERSION=`echo ${{ github.ref }} | cut -c 12-` # E.g., refs/tags/v1.2.3-rc1 => 1.2.3-rc1. + VERSION=1.0.0-rc5 + TGZ_NAME=$REPO-${VERSION}_full.tar.gz + ZIP_NAME=$REPO-${VERSION}_full.zip + # When making archives: get rid of or exclude (I do not want to `rm` .git... feels dangerous + # against GitHub Actions): + # - .git directories and files. (.gitignore and .gitmodules, among others, must stay.) + # (tar --exclude-vcs sounds delightful, but it'll exclude .gitignore and .gitmodules at least.) + # - Any tarball created earlier upon doc generation. + rm -f $REPO/doc/$REPO_doc.tgz + # XXX tar cvzf $TGZ_NAME --exclude=.git $REPO + touch xxx + tar cvzf $TGZ_NAME --exclude=.git xxx + # XXX zip -r $ZIP_NAME $REPO --exclude '*/.git/*' '*/.git' + # Soon we will need the upload URL, but unfortunately github.event.release.upload_url is only auto-populated + # on `release` trigger; whereas we want to be triggerable manually on `push` to tag v* (so a superset + # of `release` trigger). So we must figure it out via API call. + RELEASE_DATA=`curl -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ + -H 'Accept: application/vnd.github.v3+json' \ + https://api.github.com/repos/Flow-IPC/$REPO/releases/tags/v$VERSION` + echo "For release [v$VERSION]: release-data API request yielded: [$RELEASE_DATA]." + UPLOAD_URL=`echo $RELEASE_DATA | jq -r .upload_url | sed 's/{.*}$//'` + echo "For release [v$VERSION]: upload-URL was computed to be: [$UPLOAD_URL]." + echo "upload-url=$UPLOAD_URL" >> $GITHUB_OUTPUT + echo "tgz-name=$TGZ_NAME" >> $GITHUB_OUTPUT + echo "zip-name=$ZIP_NAME" >> $GITHUB_OUTPUT + echo 'description=Source code (full)' >> $GITHUB_OUTPUT + + - name: (On release creation only) Attach full source package (tarball) to Release + if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} + asset_path: ${{ github.workspace }}/../${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} + # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} + asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} + asset_content_type: application/gzip + + + + + + + - name: Install Flow-IPC dependencies (like Graphviz) with apt-get run: sudo apt-get install -y graphviz @@ -1103,11 +1163,11 @@ jobs: # We want a source tarball and/or zip to be attached to the Release. Delightfully, GitHub does this # automatically. Less delightfully, we have submodules -- where most of the code is in fact -- which GitHub # will not include (they'll just be empty dirs instead). So we upload those manually. - - name: (On release creation only) Prepare full source package(s) to attach to Release page + - name: (On release creation only) Prepare full source package(s) to attach to Release id: prep_release_pkgs if: success() && (!cancelled()) && startsWith(github.ref, 'refs/tags/v') run: | - # Prepare full source package(s) to attach to Release page. + # Prepare full source package(s) to attach to Release. cd ${{ github.workspace }}/.. REPO=ipc VERSION=`echo ${{ github.ref }} | cut -c 12-` # E.g., refs/tags/v1.2.3-rc1 => 1.2.3-rc1. @@ -1135,7 +1195,7 @@ jobs: echo "zip-name=$ZIP_NAME" >> $GITHUB_OUTPUT echo 'description=Source code (full)' >> $GITHUB_OUTPUT - - name: (On release creation only) Attach full source package (tarball) to Release page + - name: (On release creation only) Attach full source package (tarball) to Release if: (!cancelled()) && (steps.prep_release_pkgs.outcome == 'success') uses: actions/upload-release-asset@v1 env: @@ -1146,7 +1206,7 @@ jobs: asset_name: ${{ steps.prep_release_pkgs.outputs.description }} asset_content_type: application/gzip - - name: (On release creation only) Attach full source package (zip) to Release page + - name: (On release creation only) Attach full source package (zip) to Release if: (!cancelled()) && (steps.prep_release_pkgs.outcome == 'success') uses: actions/upload-release-asset@v1 env: From fe0f729b7012a6e4298a83391364431a20196cc2 Mon Sep 17 00:00:00 2001 From: Yuri Goldfeld Date: Wed, 17 Jan 2024 21:40:25 -0800 Subject: [PATCH 2/8] (experimental) --- .github/workflows/main.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d524ba0c6..4e6a5a013 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1058,13 +1058,15 @@ jobs: - name: (On release creation only) Attach full source package (tarball) to Release if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') uses: actions/upload-release-asset@v1 + #XXXGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GIT_BOT_PAT }} with: upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} asset_path: ${{ github.workspace }}/../${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} - asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} + # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} + asset_name: coolness.tar.gz asset_content_type: application/gzip @@ -1136,7 +1138,7 @@ jobs: git config user.email github-actions@github.com # We are forced to use a Personal Access Token attached to a special bot user such that in repo Settings # we've configured that "guy" as allowed to bypass the requirement to merge via PR. As of this writing - # there's no way to configure the default token to being able to do this. + # there's no way to configure the default token to be able to do this. # TODO: Keep an eye on that in case they provide for a better way: # https://github.com/orgs/community/discussions/25305 git config --local http.https://github.com/.extraheader \ From 1b9e725134e043b4fdf562a4c6aaabc8134a6992 Mon Sep 17 00:00:00 2001 From: Yuri Goldfeld Date: Wed, 17 Jan 2024 21:48:45 -0800 Subject: [PATCH 3/8] (experimental) --- .github/workflows/main.yml | 53 +++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4e6a5a013..66964100a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1025,7 +1025,7 @@ jobs: # XXX && (!cancelled()) && startsWith(github.ref, 'refs/tags/v') run: | # Prepare full source package(s) to attach to Release. - cd ${{ github.workspace }}/.. + #cd ${{ github.workspace }}/.. REPO=ipc # XXX VERSION=`echo ${{ github.ref }} | cut -c 12-` # E.g., refs/tags/v1.2.3-rc1 => 1.2.3-rc1. VERSION=1.0.0-rc5 @@ -1036,10 +1036,12 @@ jobs: # - .git directories and files. (.gitignore and .gitmodules, among others, must stay.) # (tar --exclude-vcs sounds delightful, but it'll exclude .gitignore and .gitmodules at least.) # - Any tarball created earlier upon doc generation. - rm -f $REPO/doc/$REPO_doc.tgz + #rm -f $REPO/doc/$REPO_doc.tgz # XXX tar cvzf $TGZ_NAME --exclude=.git $REPO - touch xxx - tar cvzf $TGZ_NAME --exclude=.git xxx + #cd $REPO + mkdir xxx + touch xxx/yyy.txt + tar cvzf xxx.tar.gz xxx # XXX zip -r $ZIP_NAME $REPO --exclude '*/.git/*' '*/.git' # Soon we will need the upload URL, but unfortunately github.event.release.upload_url is only auto-populated # on `release` trigger; whereas we want to be triggerable manually on `push` to tag v* (so a superset @@ -1055,7 +1057,7 @@ jobs: echo "zip-name=$ZIP_NAME" >> $GITHUB_OUTPUT echo 'description=Source code (full)' >> $GITHUB_OUTPUT - - name: (On release creation only) Attach full source package (tarball) to Release + - name: (On release creation only) Attach full source package (tarball) to Release 1 if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') uses: actions/upload-release-asset@v1 #XXXGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -1063,13 +1065,50 @@ jobs: GITHUB_TOKEN: ${{ secrets.GIT_BOT_PAT }} with: upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} - asset_path: ${{ github.workspace }}/../${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} + asset_path: xxx.tar.gz # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} - asset_name: coolness.tar.gz + asset_name: xxx.tar.gz asset_content_type: application/gzip + - name: (On release creation only) Attach full source package (tarball) to Release 2 + if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} + asset_path: xxx.tar.gz + # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} + # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} + asset_name: xxx.tar.gz + asset_content_type: application/gzip + - name: (On release creation only) Attach full source package (tarball) to Release 1a + if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GIT_BOT_PAT }} + with: + upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} + asset_path: xxx-nope.tar.gz + # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} + # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} + asset_name: xxx-nope.tar.gz + asset_content_type: application/gzip + + - name: (On release creation only) Attach full source package (tarball) to Release 2a + if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} + asset_path: xxx-nope.tar.gz + # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} + # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} + asset_name: xxx-nope.tar.gz + asset_content_type: application/gzip From 3412535c9c4d6d8421eb84cc75ff2291004e2362 Mon Sep 17 00:00:00 2001 From: Yuri Goldfeld Date: Wed, 17 Jan 2024 22:07:40 -0800 Subject: [PATCH 4/8] (experimental) --- .github/workflows/main.yml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 66964100a..bf07b6068 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1028,7 +1028,7 @@ jobs: #cd ${{ github.workspace }}/.. REPO=ipc # XXX VERSION=`echo ${{ github.ref }} | cut -c 12-` # E.g., refs/tags/v1.2.3-rc1 => 1.2.3-rc1. - VERSION=1.0.0-rc5 + VERSION=1.0.0-rc4 TGZ_NAME=$REPO-${VERSION}_full.tar.gz ZIP_NAME=$REPO-${VERSION}_full.zip # When making archives: get rid of or exclude (I do not want to `rm` .git... feels dangerous @@ -1057,6 +1057,26 @@ jobs: echo "zip-name=$ZIP_NAME" >> $GITHUB_OUTPUT echo 'description=Source code (full)' >> $GITHUB_OUTPUT + - name: Manually upload asset using curl 1 + if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/gzip" \ + -H "Content-Length: $(wc -c < xxx.tar.gz)" \ + --data-binary @xxx.tar.gz \ + "${{ steps.prep_release_pkgs.outputs.upload-url }}?name=xxx.tar.gz" + + - name: Manually upload asset using curl 2 + if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GIT_BOT_PAT }}" \ + -H "Content-Type: application/gzip" \ + -H "Content-Length: $(wc -c < xxx.tar.gz)" \ + --data-binary @xxx.tar.gz \ + "${{ steps.prep_release_pkgs.outputs.upload-url }}?name=xxx.tar.gz" + - name: (On release creation only) Attach full source package (tarball) to Release 1 if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') uses: actions/upload-release-asset@v1 From 4515f6baf91c4df5f048c1e71d114d5580bffa88 Mon Sep 17 00:00:00 2001 From: Yuri Goldfeld Date: Wed, 17 Jan 2024 22:09:21 -0800 Subject: [PATCH 5/8] (experimental) --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bf07b6068..d368e8bb7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1065,7 +1065,7 @@ jobs: -H "Content-Type: application/gzip" \ -H "Content-Length: $(wc -c < xxx.tar.gz)" \ --data-binary @xxx.tar.gz \ - "${{ steps.prep_release_pkgs.outputs.upload-url }}?name=xxx.tar.gz" + "${{ steps.prep_release_pkgsXXX.outputs.upload-url }}?name=xxx.tar.gz" - name: Manually upload asset using curl 2 if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') @@ -1075,7 +1075,7 @@ jobs: -H "Content-Type: application/gzip" \ -H "Content-Length: $(wc -c < xxx.tar.gz)" \ --data-binary @xxx.tar.gz \ - "${{ steps.prep_release_pkgs.outputs.upload-url }}?name=xxx.tar.gz" + "${{ steps.prep_release_pkgsXXX.outputs.upload-url }}?name=xxx.tar.gz" - name: (On release creation only) Attach full source package (tarball) to Release 1 if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') From 9fb7c42ef058f07987f64e62b4aaaad3ba6dabce Mon Sep 17 00:00:00 2001 From: Yuri Goldfeld Date: Wed, 17 Jan 2024 22:19:52 -0800 Subject: [PATCH 6/8] (experimental) --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d368e8bb7..54402a74e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1079,7 +1079,7 @@ jobs: - name: (On release creation only) Attach full source package (tarball) to Release 1 if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - uses: actions/upload-release-asset@v1 + uses: actions/upload-release-asset@v1.0.2 #XXXGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} env: GITHUB_TOKEN: ${{ secrets.GIT_BOT_PAT }} @@ -1093,7 +1093,7 @@ jobs: - name: (On release creation only) Attach full source package (tarball) to Release 2 if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - uses: actions/upload-release-asset@v1 + uses: actions/upload-release-asset@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -1106,7 +1106,7 @@ jobs: - name: (On release creation only) Attach full source package (tarball) to Release 1a if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - uses: actions/upload-release-asset@v1 + uses: actions/upload-release-asset@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GIT_BOT_PAT }} with: @@ -1119,7 +1119,7 @@ jobs: - name: (On release creation only) Attach full source package (tarball) to Release 2a if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - uses: actions/upload-release-asset@v1 + uses: actions/upload-release-asset@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From 51a39c0842a911061e79469705f29848c0b8d7c6 Mon Sep 17 00:00:00 2001 From: Yuri Goldfeld Date: Thu, 18 Jan 2024 16:37:52 -0800 Subject: [PATCH 7/8] (experimental) --- .github/workflows/main.yml | 94 ++++++-------------------------------- 1 file changed, 13 insertions(+), 81 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54402a74e..f9d628c8f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,8 +69,9 @@ jobs: build: needs: [setup, set-vars] + # XXX if: | - needs.setup.outputs.proceed-else-not == 'true' + needs.setup.outputs.proceed-else-not == 'true' && false strategy: fail-fast: false @@ -1025,7 +1026,7 @@ jobs: # XXX && (!cancelled()) && startsWith(github.ref, 'refs/tags/v') run: | # Prepare full source package(s) to attach to Release. - #cd ${{ github.workspace }}/.. + cd ${{ github.workspace }}/.. REPO=ipc # XXX VERSION=`echo ${{ github.ref }} | cut -c 12-` # E.g., refs/tags/v1.2.3-rc1 => 1.2.3-rc1. VERSION=1.0.0-rc4 @@ -1037,11 +1038,7 @@ jobs: # (tar --exclude-vcs sounds delightful, but it'll exclude .gitignore and .gitmodules at least.) # - Any tarball created earlier upon doc generation. #rm -f $REPO/doc/$REPO_doc.tgz - # XXX tar cvzf $TGZ_NAME --exclude=.git $REPO - #cd $REPO - mkdir xxx - touch xxx/yyy.txt - tar cvzf xxx.tar.gz xxx + tar cvzf $TGZ_NAME --exclude=.git $REPO # XXX zip -r $ZIP_NAME $REPO --exclude '*/.git/*' '*/.git' # Soon we will need the upload URL, but unfortunately github.event.release.upload_url is only auto-populated # on `release` trigger; whereas we want to be triggerable manually on `push` to tag v* (so a superset @@ -1055,87 +1052,22 @@ jobs: echo "upload-url=$UPLOAD_URL" >> $GITHUB_OUTPUT echo "tgz-name=$TGZ_NAME" >> $GITHUB_OUTPUT echo "zip-name=$ZIP_NAME" >> $GITHUB_OUTPUT - echo 'description=Source code (full)' >> $GITHUB_OUTPUT + echo 'description=Source%20code%20(full)' >> $GITHUB_OUTPUT - name: Manually upload asset using curl 1 if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') run: | + cd ${{ github.workspace }}/.. + FILE=${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: application/gzip" \ - -H "Content-Length: $(wc -c < xxx.tar.gz)" \ - --data-binary @xxx.tar.gz \ - "${{ steps.prep_release_pkgsXXX.outputs.upload-url }}?name=xxx.tar.gz" - - - name: Manually upload asset using curl 2 - if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.GIT_BOT_PAT }}" \ - -H "Content-Type: application/gzip" \ - -H "Content-Length: $(wc -c < xxx.tar.gz)" \ - --data-binary @xxx.tar.gz \ - "${{ steps.prep_release_pkgsXXX.outputs.upload-url }}?name=xxx.tar.gz" - - - name: (On release creation only) Attach full source package (tarball) to Release 1 - if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - uses: actions/upload-release-asset@v1.0.2 - #XXXGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - env: - GITHUB_TOKEN: ${{ secrets.GIT_BOT_PAT }} - with: - upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} - asset_path: xxx.tar.gz - # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} - # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} - asset_name: xxx.tar.gz - asset_content_type: application/gzip - - - name: (On release creation only) Attach full source package (tarball) to Release 2 - if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} - asset_path: xxx.tar.gz - # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} - # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} - asset_name: xxx.tar.gz - asset_content_type: application/gzip - - - name: (On release creation only) Attach full source package (tarball) to Release 1a - if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GIT_BOT_PAT }} - with: - upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} - asset_path: xxx-nope.tar.gz - # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} - # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} - asset_name: xxx-nope.tar.gz - asset_content_type: application/gzip - - - name: (On release creation only) Attach full source package (tarball) to Release 2a - if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.prep_release_pkgsXXX.outputs.upload-url }} - asset_path: xxx-nope.tar.gz - # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.description }} - # XXX asset_name: ${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} - asset_name: xxx-nope.tar.gz - asset_content_type: application/gzip - - - - + -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ + -H 'Content-Type: application/gzip' \ + -H "Content-Length: $(wc -c < $FILE)" \ + --data-binary @$FILE \ + '${{ steps.prep_release_pkgsXXX.outputs.upload-url }}?name=${{ steps.prep_release_pkgsXXX.outputs.description }}' - name: Install Flow-IPC dependencies (like Graphviz) with apt-get - run: sudo apt-get install -y graphviz + run: sudo apt-get install -y graphviz && false # XXX - name: Install the latest version of Conan which is less than 2 run: pip install 'conan<2' From b4643415b71d6ace1c397b4fdb4387bb49a8fc44 Mon Sep 17 00:00:00 2001 From: Yuri Goldfeld Date: Thu, 18 Jan 2024 17:22:04 -0800 Subject: [PATCH 8/8] upload-release-asset action refuses to work ("Invalid name for request") no matter what experimental simplification I use, so instead using curl to explicitly make the upload POST. It worked experimentally, so now doing it for real. The code is actually shorter. --- .github/workflows/main.yml | 122 +++++++++++-------------------------- 1 file changed, 35 insertions(+), 87 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f9d628c8f..666e62868 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -69,9 +69,8 @@ jobs: build: needs: [setup, set-vars] - # XXX if: | - needs.setup.outputs.proceed-else-not == 'true' && false + needs.setup.outputs.proceed-else-not == 'true' strategy: fail-fast: false @@ -1014,60 +1013,8 @@ jobs: with: submodules: true - - - - # XXX - - - - name: (On release creation only) Prepare full source package(s) to attach to Release - id: prep_release_pkgsXXX - if: success() - # XXX && (!cancelled()) && startsWith(github.ref, 'refs/tags/v') - run: | - # Prepare full source package(s) to attach to Release. - cd ${{ github.workspace }}/.. - REPO=ipc - # XXX VERSION=`echo ${{ github.ref }} | cut -c 12-` # E.g., refs/tags/v1.2.3-rc1 => 1.2.3-rc1. - VERSION=1.0.0-rc4 - TGZ_NAME=$REPO-${VERSION}_full.tar.gz - ZIP_NAME=$REPO-${VERSION}_full.zip - # When making archives: get rid of or exclude (I do not want to `rm` .git... feels dangerous - # against GitHub Actions): - # - .git directories and files. (.gitignore and .gitmodules, among others, must stay.) - # (tar --exclude-vcs sounds delightful, but it'll exclude .gitignore and .gitmodules at least.) - # - Any tarball created earlier upon doc generation. - #rm -f $REPO/doc/$REPO_doc.tgz - tar cvzf $TGZ_NAME --exclude=.git $REPO - # XXX zip -r $ZIP_NAME $REPO --exclude '*/.git/*' '*/.git' - # Soon we will need the upload URL, but unfortunately github.event.release.upload_url is only auto-populated - # on `release` trigger; whereas we want to be triggerable manually on `push` to tag v* (so a superset - # of `release` trigger). So we must figure it out via API call. - RELEASE_DATA=`curl -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ - -H 'Accept: application/vnd.github.v3+json' \ - https://api.github.com/repos/Flow-IPC/$REPO/releases/tags/v$VERSION` - echo "For release [v$VERSION]: release-data API request yielded: [$RELEASE_DATA]." - UPLOAD_URL=`echo $RELEASE_DATA | jq -r .upload_url | sed 's/{.*}$//'` - echo "For release [v$VERSION]: upload-URL was computed to be: [$UPLOAD_URL]." - echo "upload-url=$UPLOAD_URL" >> $GITHUB_OUTPUT - echo "tgz-name=$TGZ_NAME" >> $GITHUB_OUTPUT - echo "zip-name=$ZIP_NAME" >> $GITHUB_OUTPUT - echo 'description=Source%20code%20(full)' >> $GITHUB_OUTPUT - - - name: Manually upload asset using curl 1 - if: (!cancelled()) && (steps.prep_release_pkgsXXX.outcome == 'success') - run: | - cd ${{ github.workspace }}/.. - FILE=${{ steps.prep_release_pkgsXXX.outputs.tgz-name }} - curl -X POST \ - -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ - -H 'Content-Type: application/gzip' \ - -H "Content-Length: $(wc -c < $FILE)" \ - --data-binary @$FILE \ - '${{ steps.prep_release_pkgsXXX.outputs.upload-url }}?name=${{ steps.prep_release_pkgsXXX.outputs.description }}' - - name: Install Flow-IPC dependencies (like Graphviz) with apt-get - run: sudo apt-get install -y graphviz && false # XXX + run: sudo apt-get install -y graphviz - name: Install the latest version of Conan which is less than 2 run: pip install 'conan<2' @@ -1156,21 +1103,40 @@ jobs: # We want a source tarball and/or zip to be attached to the Release. Delightfully, GitHub does this # automatically. Less delightfully, we have submodules -- where most of the code is in fact -- which GitHub # will not include (they'll just be empty dirs instead). So we upload those manually. - - name: (On release creation only) Prepare full source package(s) to attach to Release - id: prep_release_pkgs + # + # Regarding the actual upload request (x2): We do it via curl, following the documented GitHub API. + # Some resources recommend doing this (x2) instead: + # uses: actions/upload-release-asset@v1.0.2 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.prep_release_pkgs.outputs.upload-url }} + # asset_path: ${{ github.workspace }}/../${{ steps.prep_release_pkgs.outputs.tgz-name }} + # asset_name: ${{ steps.prep_release_pkgs.outputs.tgz-name }} + # asset_content_type: application/gzip + # For me (ygoldfel), despite a few hours of trying this and that and attempting to get debug output, it kept + # yielding `Invalid name for request` error with no added info. Reasons might be: some silly error on my part + # (but it is very vanilla, and I reduced it down to the bare essentials with no success, while also eliminating + # possibilities like it being unable to find the local file to upload and other stupidities); a change in API + # or some other behavior that was not handled by the upload-release-asset action package; possibly a break + # in a dependency of upload-release-asset (octokat?). upload-release-asset was last updated in 2020 and is + # officially now unmaintained. So I fought valiantly but eventually moved onto just using curl which worked + # almost immediately. Since the resulting code isn't even longer, and we are using a documented public API and + # standard tool (curl) which we also use elsewhere, it seemed a reasonable approach. TODO: Revisit perhaps. + - name: (On release creation only) Attach full source package(s) to Release if: success() && (!cancelled()) && startsWith(github.ref, 'refs/tags/v') run: | - # Prepare full source package(s) to attach to Release. + # Attach full source package(s) to Release cd ${{ github.workspace }}/.. REPO=ipc VERSION=`echo ${{ github.ref }} | cut -c 12-` # E.g., refs/tags/v1.2.3-rc1 => 1.2.3-rc1. TGZ_NAME=$REPO-${VERSION}_full.tar.gz ZIP_NAME=$REPO-${VERSION}_full.zip - # When making archives: get rid of or exclude (I do not want to `rm` .git... feels dangerous - # against GitHub Actions): + # When making archives: get rid of or exclude (I do not want to `rm -rf` .git... feels dangerous-ish, as + # GitHub Actions cleans up checkouts later... just don't do it) the following: # - .git directories and files. (.gitignore and .gitmodules, among others, must stay.) # (tar --exclude-vcs sounds delightful, but it'll exclude .gitignore and .gitmodules at least.) - # - Any tarball created earlier upon doc generation. + # - Any doc tarball created earlier upon doc generation. rm -f $REPO/doc/$REPO_doc.tgz tar cvzf $TGZ_NAME --exclude=.git $REPO zip -r $ZIP_NAME $REPO --exclude '*/.git/*' '*/.git' @@ -1183,32 +1149,14 @@ jobs: echo "For release [v$VERSION]: release-data API request yielded: [$RELEASE_DATA]." UPLOAD_URL=`echo $RELEASE_DATA | jq -r .upload_url | sed 's/{.*}$//'` echo "For release [v$VERSION]: upload-URL was computed to be: [$UPLOAD_URL]." - echo "upload-url=$UPLOAD_URL" >> $GITHUB_OUTPUT - echo "tgz-name=$TGZ_NAME" >> $GITHUB_OUTPUT - echo "zip-name=$ZIP_NAME" >> $GITHUB_OUTPUT - echo 'description=Source code (full)' >> $GITHUB_OUTPUT - - - name: (On release creation only) Attach full source package (tarball) to Release - if: (!cancelled()) && (steps.prep_release_pkgs.outcome == 'success') - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.prep_release_pkgs.outputs.upload-url }} - asset_path: ${{ github.workspace }}/../${{ steps.prep_release_pkgs.outputs.tgz-name }} - asset_name: ${{ steps.prep_release_pkgs.outputs.description }} - asset_content_type: application/gzip - - - name: (On release creation only) Attach full source package (zip) to Release - if: (!cancelled()) && (steps.prep_release_pkgs.outcome == 'success') - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.prep_release_pkgs.outputs.upload-url }} - asset_path: ${{ github.workspace }}/../${{ steps.prep_release_pkgs.outputs.zip-name }} - asset_name: ${{ steps.prep_release_pkgs.outputs.description }} - asset_content_type: application/zip + curl --fail-with-body -X POST \ + -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ + -H 'Content-Type: application/gzip' -H "Content-Length: $(wc -c < $TGZ_NAME)" \ + --data-binary @$TGZ_NAME "$UPLOAD_URL?name=$TGZ_NAME" + curl --fail-with-body -X POST \ + -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' \ + -H 'Content-Type: application/zip' -H "Content-Length: $(wc -c < $ZIP_NAME)" \ + --data-binary @$ZIP_NAME "$UPLOAD_URL?name=$ZIP_NAME" - name: (On release creation only) Signal Pages about release (web site should update) if: success() && (!cancelled()) && startsWith(github.ref, 'refs/tags/v')