Skip to content

Commit 2973f68

Browse files
committed
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.
1 parent 24e957a commit 2973f68

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

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

Lines changed: 35 additions & 0 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'
@@ -82,3 +85,35 @@ runs:
8285
asset_name: faustwp.${{ env.VERSION }}.org.zip
8386
tag_name: canary
8487
overwrite: true
88+
89+
- id: generate-info-json
90+
name: Fetch and update info.json for WPE release
91+
run: |
92+
# Fetch the info.json file and set variables
93+
curl -sSL "https://wpe-plugin-updates.wpengine.com/faustwp/info.json" -o info.json
94+
current_time=$(date -u +"%Y-%m-%d %-I:%M%p GMT")
95+
download_link="https://wpe-plugin-updates.wpengine.com/faustwp/faustwp.${{ env.VERSION }}.zip"
96+
97+
# Update the info.json file with the new version and download link
98+
jq \
99+
--arg version "${{ env.VERSION }}" \
100+
--arg last_updated "$current_time" \
101+
--arg download_link "$download_link" \
102+
--arg new_version "${{ env.VERSION }}" \
103+
--arg new_download_link "https://wpe-plugin-updates.wpengine.com/faustwp/faustwp.${{ env.VERSION }}.zip" \
104+
'.versions = {($new_version): $new_download_link} + .versions | .version=$version | .last_updated=$last_updated | .download_link=$download_link' \
105+
info.json > info.json.tmp && mv info.json.tmp info.json
106+
107+
# Output the modified file path
108+
echo "info-json-path=$PWD/info.json" >> $GITHUB_ENV
109+
shell: bash
110+
111+
- id: upload-info-json-to-github
112+
name: Upload info.json to GitHub Releases
113+
uses: softprops/action-gh-release@v2
114+
with:
115+
token: ${{ inputs.github_token }}
116+
files: ${{ env.info-json-path }}
117+
asset_name: info.json
118+
tag_name: canary
119+
overwrite: true

.github/workflows/debug.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Fetch, Modify, and Output info.json
2+
3+
on:
4+
push:
5+
branches:
6+
- bug-fix-github-workflow-faustwp-issues
7+
8+
jobs:
9+
fetch_modify_info_json:
10+
name: Fetch, Modify, and Output info.json
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Fetch info.json
17+
run: |
18+
curl -sSL "https://wpe-plugin-updates.wpengine.com/faustwp/info.json" -o info.json
19+
20+
- name: Modify info.json using jq
21+
run: |
22+
current_time=$(date -u +"%Y-%m-%d %-I:%M%p GMT")
23+
version="1.8.1" # Replace this with your version dynamically if needed
24+
download_link="https://wpe-plugin-updates.wpengine.com/faustwp/faustwp.${version}.zip"
25+
26+
# Use jq to modify the info.json file
27+
jq \
28+
--arg version "$version" \
29+
--arg last_updated "$current_time" \
30+
--arg download_link "$download_link" \
31+
--arg new_version "$version" \
32+
--arg new_download_link "$download_link" \
33+
'.versions = {($new_version): $new_download_link} + .versions | .version=$version | .last_updated=$last_updated | .download_link=$download_link' \
34+
info.json > info.json.tmp && mv info.json.tmp info.json
35+
36+
- name: Output modified info.json
37+
run: |
38+
echo "Modified info.json content:"
39+
cat info.json

0 commit comments

Comments
 (0)