diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index d6ae23f..f99e2ba 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -45,7 +45,39 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git commit -m "chore: add VERSION $version" --allow-empty - git push --set-upstream origin "$branch" + + + - name: Sync upstream JSONs + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + tmp_dir=$(mktemp -d) + api_url="https://api.github.com/repos/community-scripts/ProxmoxVE/contents/frontend/public/json" + # Fetch file list (no subfolders) + curl -sSL -H "Authorization: token $GH_TOKEN" "$api_url" \ + | jq -r '.[] | select(.type=="file") | .name' > "$tmp_dir/files.txt" + + # Download each file + while IFS= read -r name; do + curl -sSL -H "Authorization: token $GH_TOKEN" \ + "https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/frontend/public/json/$name" \ + -o "$tmp_dir/$name" + done < "$tmp_dir/files.txt" + + mkdir -p json + rsync -a --delete "$tmp_dir/" json/ + + # Stage and amend commit to include JSON updates (and VERSION) + git add json VERSION + if ! git diff --cached --quiet; then + git commit --amend --no-edit + fi + + + - name: Push changes + run: | + git push --force-with-lease --set-upstream origin "update-version-${{ steps.draft.outputs.tag_name }}" - name: Create PR with GitHub CLI