1.7.3 #45
Workflow file for this run
This file contains 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: "Publish Release" | |
on: | |
push: | |
tags: | |
- "v*" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
run-tests-and-linter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
- run: npm clean-install | |
- run: npm run lint | |
- run: npm run test | |
create-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: run-tests-and-linter | |
outputs: | |
release_id: ${{ steps.create-release.outputs.result }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Get version | |
run: echo "PACKAGE_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
- name: Create release | |
id: create-release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const fs = require('fs'); | |
const changelogContent = fs.readFileSync('changelog.md', 'utf-8'); | |
const regex = new RegExp( `(?<=\\[${process.env.PACKAGE_VERSION}\\]\\s)([\\s\\S]*?)(?=\\s## \\[)`, 'g'); | |
const releaseNotes = changelogContent.match(regex)?.[0].trim() || ''; | |
const { data } = await github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: `v${process.env.PACKAGE_VERSION}`, | |
name: `Seelen UI v${process.env.PACKAGE_VERSION}`, | |
body: releaseNotes + "\n", | |
generate_release_notes: true, | |
draft: true, | |
prerelease: false, | |
}); | |
return data.id; | |
build-installers: | |
needs: create-release | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- platform: "windows-latest" | |
args: "" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
- name: Install winget | |
uses: Cyberboss/install-winget@v1 | |
- name: Install MSIX dependencies | |
if: matrix.platform == 'windows-latest' | |
shell: powershell | |
run: | | |
winget install --id Microsoft.DotNet.AspNetCore.8 --accept-package-agreements --accept-source-agreements --force | |
winget install --id Microsoft.DotNet.DesktopRuntime.8 --accept-package-agreements --accept-source-agreements --force | |
winget install --id MarcinOtorowski.MSIXHero --accept-package-agreements --accept-source-agreements --force | |
- name: Install frontend dependencies | |
run: npm install | |
- uses: tauri-apps/tauri-action@v0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
with: | |
releaseId: ${{ needs.create-release.outputs.release_id }} | |
args: ${{ matrix.args }} | |
- name: Bundle MSIX | |
run: npx ts-node scripts/bundle.msix.ts | |
- name: Add msix to release | |
uses: "actions/github-script@v7" | |
env: | |
releaseId: ${{ needs.create-release.outputs.release_id }} | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
const fs = require('fs'); | |
const packageJson = require('./package.json'); | |
const packageVersion = packageJson.version + '.0'; | |
await github.rest.repos.uploadReleaseAsset({ | |
name: `Seelen.SeelenUI_${packageVersion}_x64__p6yyn03m1894e.msix`, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.releaseId, | |
data: fs.readFileSync(`./target/release/bundle/msix/Seelen.SeelenUI_${packageVersion}_x64__p6yyn03m1894e.msix`) | |
}); | |
publish-release: | |
needs: [build-installers, create-release] | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Publish release | |
uses: actions/github-script@v7 | |
env: | |
releaseId: ${{ needs.create-release.outputs.release_id }} | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
const result = await github.rest.repos.listReleaseAssets({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.releaseId, | |
}); | |
result.data.forEach(async (asset) => { | |
if (asset.name.endsWith('.sig')) { | |
await github.rest.repos.deleteReleaseAsset({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
asset_id: asset.id, | |
}); | |
} | |
}); | |
await github.rest.repos.updateRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
release_id: process.env.releaseId, | |
draft: false, | |
}); |