From b336ab151c7c14d30184e435484d1f5fdca26de1 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 17 Jun 2025 16:21:47 +1000 Subject: [PATCH 1/5] Add unzip check --- .forgejo/workflows/wordpress-plugin.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/wordpress-plugin.yml b/.forgejo/workflows/wordpress-plugin.yml index 52d89ec..7b962a3 100644 --- a/.forgejo/workflows/wordpress-plugin.yml +++ b/.forgejo/workflows/wordpress-plugin.yml @@ -53,6 +53,7 @@ jobs: cd build zip -r "../${PLUGIN_NAME}.zip" "${PLUGIN_NAME}" cd - + unzip -l "${PLUGIN_NAME}.zip" - name: Create Release if not exists run: | From ad1212df4c4a401a3e0c8956860e2351f6051d83 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 17 Jun 2025 16:22:09 +1000 Subject: [PATCH 2/5] Ensure unzip installed God why do we still use zip when tar.gz is superior in every way --- .forgejo/workflows/wordpress-plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/wordpress-plugin.yml b/.forgejo/workflows/wordpress-plugin.yml index 7b962a3..ea415dc 100644 --- a/.forgejo/workflows/wordpress-plugin.yml +++ b/.forgejo/workflows/wordpress-plugin.yml @@ -34,7 +34,7 @@ jobs: - name: Prepare Build Environment run: | - apt update && apt -y install zip nodejs curl jq + apt update && apt -y install zip unzip nodejs curl jq - name: Checkout repo uses: actions/checkout@v4 From c25710e4bdb0dd3b5fd8cadf5f5c7aaf23bc1312 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 17 Jun 2025 16:24:57 +1000 Subject: [PATCH 3/5] Use file not raw binary --- .forgejo/workflows/wordpress-plugin.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/wordpress-plugin.yml b/.forgejo/workflows/wordpress-plugin.yml index ea415dc..f6ac5ec 100644 --- a/.forgejo/workflows/wordpress-plugin.yml +++ b/.forgejo/workflows/wordpress-plugin.yml @@ -87,7 +87,8 @@ jobs: | jq -r '.id') # Pushes he zip file to be shown in the "Releases" tab under this release. - curl -X POST "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${PLUGIN_NAME}.zip" \ + curl -X POST "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ - -H "Content-Type: application/zip" \ - --data-binary "@build/${PLUGIN_NAME}.zip" + -F "name=${PLUGIN_NAME}.zip" \ + -F "attachment=@build/${PLUGIN_NAME}.zip" + From e295fcbfb36330f39fc5b7e4e361294f7d5fd80b Mon Sep 17 00:00:00 2001 From: j Date: Tue, 17 Jun 2025 16:26:58 +1000 Subject: [PATCH 4/5] Remove build from plugin upload --- .forgejo/workflows/wordpress-plugin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.forgejo/workflows/wordpress-plugin.yml b/.forgejo/workflows/wordpress-plugin.yml index f6ac5ec..f6325b8 100644 --- a/.forgejo/workflows/wordpress-plugin.yml +++ b/.forgejo/workflows/wordpress-plugin.yml @@ -90,5 +90,5 @@ jobs: curl -X POST "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ -F "name=${PLUGIN_NAME}.zip" \ - -F "attachment=@build/${PLUGIN_NAME}.zip" + -F "attachment=@${PLUGIN_NAME}.zip" From 9f9d7c58bb93fcb55825a63a9e05df10b5a71bc8 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 17 Jun 2025 16:29:42 +1000 Subject: [PATCH 5/5] Mention about content-type --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 711c83b..9957003 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # workflow-sample-wordpress-plugin -A sample workflow that demonstrates how I prefer to store my Wordpress plugins in a repository, and how to publish them to "releases". \ No newline at end of file +A sample workflow that demonstrates how I prefer to store my Wordpress plugins in a repository, and how to publish them to "releases". + +Wordpress code is just some ChatGPT sample I asked it to generate. Tested and +the zip is dumpable. + +Worth noting that the way we upload the Zip may not work for Github. Forgejo +requires a multipart/form-data content type where-as Github may require binary. +I'm not 100% sure because I don't use Github much at the moment. If you're +downloading corrupt zips though, this is probably why.