diff --git a/.forgejo/workflows/wordpress-plugin.yml b/.forgejo/workflows/wordpress-plugin.yml index f6325b8..9d4542a 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 unzip nodejs curl jq + apt update && apt -y install zip nodejs curl jq - name: Checkout repo uses: actions/checkout@v4 @@ -47,13 +47,10 @@ jobs: # Create a build directory to ensure that we're correctly creating # a single child directory in the zip. mkdir -p build - cp -r ${SOURCE_DIR} "build/${PLUGIN_NAME}" + cp -r ${SOURCE_DIR}/* "build/${PLUGIN_NAME}" # Zip it up for shipping - cd build - zip -r "../${PLUGIN_NAME}.zip" "${PLUGIN_NAME}" - cd - - unzip -l "${PLUGIN_NAME}.zip" + zip -r "${PLUGIN_NAME}.zip" "build/${PLUGIN_NAME}" - name: Create Release if not exists run: | @@ -87,8 +84,7 @@ 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" \ + curl -X POST "${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=${PLUGIN_NAME}.zip" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ - -F "name=${PLUGIN_NAME}.zip" \ - -F "attachment=@${PLUGIN_NAME}.zip" - + -H "Content-Type: application/zip" \ + --data-binary "@build/${PLUGIN_NAME}.zip" diff --git a/README.md b/README.md index 9957003..711c83b 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,3 @@ # 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". - -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. +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