Skip to content

Commit 700f96e

Browse files
authored
bug: Fixes for Github workflow for faustwp releases (#2066)
* Variou fixes for the faustwp release 1. Renamed files correctly e.g. faustwp.1.8.1.zip 2. Fixed issue with zips attaching to a tag rather than the canary branch and creating another releae. 3. Fixed issue that the zip is using dist rather than faustwp as the directory to be zipped. * Updated release workflow Added some automation for changes for the info.json for WPE updater. Added a test debug to see if the info.json changes work as they did locally and outputting the content. * Renamed debug file. * Removed debug action. * Move info.json changes into a bash script. * Fixed debug script. * Fixing path for bash script. * Fixing file path for the bash script. * Fixed version for debug script. * Removed debug script. * Added Changeset
1 parent 134f823 commit 700f96e

File tree

3 files changed

+53
-10
lines changed

3 files changed

+53
-10
lines changed

.changeset/giant-coats-explode.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@faustwp/wordpress-plugin": patch
3+
---
4+
5+
bug: Fixes for Github workflow for faustwp releases. Added WPE info.json and automated for the release.

.github/actions/release-plugin/action.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ outputs:
1616
org-zip-path:
1717
description: 'Path to .org zip file'
1818
value: ${{ steps.zip-org-release-for-github.outputs.zip-path }}
19+
info-json-path:
20+
description: 'Path to info.json file'
21+
value: ${{ steps.generate-info-json.outputs.info-json-path }}
1922

2023
runs:
2124
using: 'composite'
@@ -31,8 +34,10 @@ runs:
3134
mkdir -p dist
3235
rsync -av --exclude-from="${{ env.PLUGIN_DIR }}/.distignore" ${{ env.PLUGIN_DIR }}/ dist/${{ env.SLUG }}
3336
34-
zip_file="faustwp-${{ env.VERSION }}.zip"
35-
zip -r "$zip_file" "dist/${{ env.SLUG }}"
37+
zip_file="faustwp.${{ env.VERSION }}.zip"
38+
cd "dist/${{ env.SLUG }}"
39+
zip -r "../../$zip_file" .
40+
cd -
3641
3742
echo "zip-path=$PWD/$zip_file" >> $GITHUB_ENV
3843
shell: bash
@@ -53,11 +58,11 @@ runs:
5358
# Allow updates for .org
5459
sed -i -e '/\* Update URI: false/d' "dist/${{ env.SLUG }}/faustwp.php"
5560
56-
# Create .org zip file
57-
org_zip_file="faustwp-${{ env.VERSION }}.org.zip"
58-
zip -r "$org_zip_file" "dist/${{ env.SLUG }}"
61+
org_zip_file="faustwp.${{ env.VERSION }}.org.zip"
62+
cd "dist/${{ env.SLUG }}"
63+
zip -r "../../$org_zip_file" .
64+
cd -
5965
60-
# Save zip path to output
6166
echo "org-zip-path=$PWD/$org_zip_file" >> $GITHUB_ENV
6267
shell: bash
6368

@@ -67,8 +72,8 @@ runs:
6772
with:
6873
token: ${{ inputs.github_token }}
6974
files: ${{ env.zip-path }}
70-
asset_name: faustwp-${{ env.VERSION }}.zip
71-
tag_name: ${{ env.VERSION }}
75+
asset_name: faustwp.${{ env.VERSION }}.zip
76+
tag_name: canary
7277
overwrite: true
7378

7479
- id: upload-org-release-to-github
@@ -77,6 +82,23 @@ runs:
7782
with:
7883
token: ${{ inputs.github_token }}
7984
files: ${{ env.org-zip-path }}
80-
asset_name: faustwp-${{ env.VERSION }}.org.zip
81-
tag_name: ${{ env.VERSION }}
85+
asset_name: faustwp.${{ env.VERSION }}.org.zip
86+
tag_name: canary
87+
overwrite: true
88+
89+
- id: generate-info-json
90+
name: Fetch and update info.json for WPE release
91+
run: |
92+
bash .github/scripts/add-wpe-version-info-file.sh ${{ env.VERSION }}
93+
echo "info-json-path=$PWD/info.json" >> $GITHUB_ENV
94+
shell: bash
95+
96+
- id: upload-info-json-to-github
97+
name: Upload info.json to GitHub Releases
98+
uses: softprops/action-gh-release@v2
99+
with:
100+
token: ${{ inputs.github_token }}
101+
files: ${{ env.info-json-path }}
102+
asset_name: info.json
103+
tag_name: canary
82104
overwrite: true
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
VERSION=$1
3+
4+
curl -sSL "https://wpe-plugin-updates.wpengine.com/faustwp/info.json" -o info.json
5+
current_time=$(date -u +"%Y-%m-%d %-I:%M%p GMT")
6+
download_link="https://wpe-plugin-updates.wpengine.com/faustwp/faustwp.${VERSION}.zip"
7+
8+
# Update the info.json file with the new version and download link
9+
jq \
10+
--arg version "$VERSION" \
11+
--arg last_updated "$current_time" \
12+
--arg download_link "$download_link" \
13+
--arg new_version "$VERSION" \
14+
--arg new_download_link "https://wpe-plugin-updates.wpengine.com/faustwp/faustwp.${VERSION}.zip" \
15+
'.versions = {($new_version): $new_download_link} + .versions | .version=$version | .last_updated=$last_updated | .download_link=$download_link' \
16+
info.json > info.json.tmp && mv info.json.tmp info.json

0 commit comments

Comments
 (0)