XE Launcher v0.2.12 #8
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate Update Manifest | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Release tag to generate manifest for' | |
| required: true | |
| type: string | |
| jobs: | |
| generate-manifest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get release info | |
| id: get-release | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| let tag = '${{ github.event.release.tag_name || inputs.tag }}'; | |
| const release = await github.rest.repos.getReleaseByTag({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag: tag | |
| }); | |
| const assets = release.data.assets; | |
| const version = tag.replace('v', ''); | |
| // Find update artifacts | |
| const updateArtifacts = { | |
| 'darwin-x86_64': assets.find(a => a.name.includes('x64') && a.name.endsWith('.tar.gz')), | |
| 'darwin-aarch64': assets.find(a => a.name.includes('aarch64') && a.name.endsWith('.tar.gz')), | |
| 'linux-x86_64': assets.find(a => a.name.includes('x86_64') && a.name.endsWith('.AppImage.tar.gz')), | |
| 'windows-x86_64': assets.find(a => a.name.includes('x64') && a.name.endsWith('.msi.zip')) | |
| }; | |
| const signatures = { | |
| 'darwin-x86_64': assets.find(a => a.name === updateArtifacts['darwin-x86_64']?.name + '.sig'), | |
| 'darwin-aarch64': assets.find(a => a.name === updateArtifacts['darwin-aarch64']?.name + '.sig'), | |
| 'linux-x86_64': assets.find(a => a.name === updateArtifacts['linux-x86_64']?.name + '.sig'), | |
| 'windows-x86_64': assets.find(a => a.name === updateArtifacts['windows-x86_64']?.name + '.sig') | |
| }; | |
| return { | |
| version, | |
| notes: release.data.body, | |
| pub_date: release.data.published_at, | |
| platforms: { | |
| 'darwin-x86_64': updateArtifacts['darwin-x86_64'] ? { | |
| signature: signatures['darwin-x86_64'] ? await (await fetch(signatures['darwin-x86_64'].browser_download_url)).text() : '', | |
| url: updateArtifacts['darwin-x86_64'].browser_download_url | |
| } : null, | |
| 'darwin-aarch64': updateArtifacts['darwin-aarch64'] ? { | |
| signature: signatures['darwin-aarch64'] ? await (await fetch(signatures['darwin-aarch64'].browser_download_url)).text() : '', | |
| url: updateArtifacts['darwin-aarch64'].browser_download_url | |
| } : null, | |
| 'linux-x86_64': updateArtifacts['linux-x86_64'] ? { | |
| signature: signatures['linux-x86_64'] ? await (await fetch(signatures['linux-x86_64'].browser_download_url)).text() : '', | |
| url: updateArtifacts['linux-x86_64'].browser_download_url | |
| } : null, | |
| 'windows-x86_64': updateArtifacts['windows-x86_64'] ? { | |
| signature: signatures['windows-x86_64'] ? await (await fetch(signatures['windows-x86_64'].browser_download_url)).text() : '', | |
| url: updateArtifacts['windows-x86_64'].browser_download_url | |
| } : null | |
| } | |
| }; | |
| - name: Create update manifest | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const fs = require('fs'); | |
| const releaseInfo = ${{ steps.get-release.outputs.result }}; | |
| const manifest = { | |
| version: releaseInfo.version, | |
| notes: releaseInfo.notes, | |
| pub_date: releaseInfo.pub_date, | |
| platforms: {} | |
| }; | |
| // Add only platforms that have artifacts | |
| for (const [platform, data] of Object.entries(releaseInfo.platforms)) { | |
| if (data) { | |
| manifest.platforms[platform] = data; | |
| } | |
| } | |
| // Write manifest files | |
| fs.writeFileSync('update-manifest.json', JSON.stringify(manifest, null, 2)); | |
| fs.writeFileSync('update-manifest-v${{ steps.get-release.outputs.result.version }}.json', JSON.stringify(manifest, null, 2)); | |
| - name: Upload manifests to release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ github.event.release.tag_name || inputs.tag }} | |
| files: | | |
| update-manifest.json | |
| update-manifest-v*.json | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload latest manifest to GitHub Pages | |
| if: ${{ !contains(steps.get-release.outputs.result.version, 'beta') && !contains(steps.get-release.outputs.result.version, 'alpha') }} | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| # Create gh-pages branch if it doesn't exist | |
| git checkout --orphan gh-pages || git checkout gh-pages | |
| # Copy manifest | |
| cp update-manifest.json index.json | |
| # Commit and push | |
| git add index.json | |
| git commit -m "Update manifest for v${{ steps.get-release.outputs.result.version }}" | |
| git push origin gh-pages --force |