@@ -101,19 +101,24 @@ jobs:
101
101
const tagName = "${{ steps.get_latest_official_release.outputs.tag_name }}";
102
102
const fs = require('fs');
103
103
const path = require('path');
104
+ // Get the release assets for the specified tag
105
+ const { data: releaseData } = await github.rest.repos.getReleaseByTag({
106
+ owner: context.repo.owner,
107
+ repo: context.repo.repo,
108
+ tag: tagName
109
+ });
110
+ const releaseId = releaseData.id;
104
111
const { data: releaseAssets } = await github.rest.repos.listReleaseAssets({
105
112
owner: context.repo.owner,
106
113
repo: context.repo.repo,
107
- release_id: (await github.rest.repos.getReleaseByTag({
108
- owner: context.repo.owner,
109
- repo: context.repo.repo,
110
- tag: tagName
111
- })).data.id
114
+ release_id: releaseId
112
115
});
116
+ // Look for the 'appcast.xml' asset
113
117
const appcastAsset = releaseAssets.find(asset => asset.name === 'appcast.xml');
114
118
if (!appcastAsset) {
115
119
throw new Error('appcast.xml not found in the release assets.');
116
120
}
121
+ // Download the file content (as an ArrayBuffer)
117
122
const { data: fileContent } = await github.rest.repos.getReleaseAsset({
118
123
owner: context.repo.owner,
119
124
repo: context.repo.repo,
@@ -122,9 +127,10 @@ jobs:
122
127
Accept: 'application/octet-stream'
123
128
}
124
129
});
130
+ // Convert ArrayBuffer -> Buffer, then write to disk
125
131
const outputDir = path.join(process.env.GITHUB_WORKSPACE, 'dist', 'appcast');
126
132
fs.mkdirSync(outputDir, { recursive: true });
127
- fs.writeFileSync(path.join(outputDir, 'appcast.xml'), fileContent);
133
+ fs.writeFileSync(path.join(outputDir, 'appcast.xml'), Buffer.from( fileContent) );
128
134
console.log('appcast.xml downloaded successfully.');
129
135
- name : Deploy to GitHub Pages
130
136
uses : peaceiris/actions-gh-pages@v3
0 commit comments