Fix release workflow (#2668)

* Fix frontend bundle upload
 - Update pnpm

* Revert incorrect removal of fontenf packaging job

* Fix tauri not building updater bundles

* Ensure release action is executed when PRs modify the publish-artifacts action

* Fix unused argument for patchTauri function

* Couple for format fixes

* tauri requires building the app bundle to build the updater
This commit is contained in:
Vítor Vasconcellos
2024-08-17 08:29:32 +00:00
committed by GitHub
parent f2f39a2a46
commit 287a809de0
14 changed files with 116 additions and 83 deletions

View File

@@ -1,8 +1,23 @@
module.exports = {
extends: [require.resolve('@sd/config/eslint/base.js')],
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json'
root: true,
env: {
'node': true,
'es2022': true,
'browser': false,
'commonjs': false,
'shared-node-browser': false
},
ignorePatterns: ['dist/**/*']
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'standard',
'plugin:@typescript-eslint/strict-type-checked',
'plugin:@typescript-eslint/stylistic-type-checked',
'plugin:prettier/recommended'
],
plugins: ['@typescript-eslint'],
parserOptions: {
project: true
},
ignorePatterns: ['node_modules/**/*', 'dist/**/*']
};

View File

@@ -6,11 +6,16 @@ import { exists } from '@actions/io/lib/io-util';
type OS = 'darwin' | 'windows' | 'linux';
type Arch = 'x64' | 'arm64';
type TargetConfig = { bundle: string; ext: string };
type BuildTarget = {
interface TargetConfig {
ext: string;
bundle: string;
}
interface BuildTarget {
updater: false | { bundle: string; bundleExt: string; archiveExt: string };
standalone: Array<TargetConfig>;
};
standalone: TargetConfig[];
}
const OS_TARGETS = {
darwin: {
@@ -36,8 +41,8 @@ const OS_TARGETS = {
} satisfies Record<OS, BuildTarget>;
// Workflow inputs
const OS: OS = core.getInput('os') as any;
const ARCH: Arch = core.getInput('arch') as any;
const OS = core.getInput('os') as OS;
const ARCH = core.getInput('arch') as Arch;
const TARGET = core.getInput('target');
const PROFILE = core.getInput('profile');
@@ -59,7 +64,11 @@ async function uploadFrontend() {
return;
}
await client.uploadArtifact(FRONTEND_ARCHIVE_NAME, [FRONT_END_BUNDLE], 'apps/desktop');
const artifactName = `${FRONTEND_ARCHIVE_NAME}.tar.xz`;
const artifactPath = `${ARTIFACTS_DIR}/${artifactName}`;
await io.cp(FRONT_END_BUNDLE, artifactPath);
await client.uploadArtifact(artifactName, [artifactPath], ARTIFACTS_DIR);
}
async function uploadUpdater(updater: BuildTarget['updater']) {
@@ -69,7 +78,7 @@ async function uploadUpdater(updater: BuildTarget['updater']) {
const files = await globFiles(`${BUNDLE_DIR}/${bundle}/*.${fullExt}*`);
const updaterPath = files.find((file) => file.endsWith(fullExt));
if (!updaterPath) throw new Error(`Updater path not found. Files: ${files}`);
if (!updaterPath) throw new Error(`Updater path not found. Files: ${files.join(',')}`);
const artifactPath = `${ARTIFACTS_DIR}/${UPDATER_ARTIFACT_NAME}.${archiveExt}`;
@@ -88,7 +97,7 @@ async function uploadStandalone({ bundle, ext }: TargetConfig) {
const files = await globFiles(`${BUNDLE_DIR}/${bundle}/*.${ext}*`);
const standalonePath = files.find((file) => file.endsWith(ext));
if (!standalonePath) throw new Error(`Standalone path not found. Files: ${files}`);
if (!standalonePath) throw new Error(`Standalone path not found. Files: ${files.join(',')}`);
const artifactName = `${ARTIFACT_BASE}.${ext}`;
const artifactPath = `${ARTIFACTS_DIR}/${artifactName}`;
@@ -108,4 +117,8 @@ async function run() {
...standalone.map((config) => uploadStandalone(config))
]);
}
run();
run().catch((error: unknown) => {
console.error(error);
process.exit(1);
});

View File

@@ -7,13 +7,12 @@
"lint": "eslint . --cache"
},
"dependencies": {
"@actions/artifact": "^2.1.7",
"@actions/artifact": "^2.1.9",
"@actions/core": "^1.10.1",
"@actions/glob": "^0.4.0",
"@actions/glob": "^0.5.0",
"@actions/io": "^1.1.3"
},
"devDependencies": {
"@vercel/ncc": "^0.38.1",
"@sd/config": "workspace:*"
"@vercel/ncc": "^0.38.1"
}
}

View File

@@ -1,12 +1,30 @@
{
"compilerOptions": {
"target": "es2015" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"module": "esnext" /* Specify what module code is generated. */,
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
"strict": true /* Enable all strict type-checking options. */,
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
"noEmit": true
}
"lib": ["esnext"],
"noEmit": true,
"strict": true,
"module": "esnext",
"target": "esnext",
"declaration": false,
"incremental": true,
"skipLibCheck": true,
"removeComments": false,
"noUnusedLocals": true,
"isolatedModules": true,
"esModuleInterop": true,
"disableSizeLimit": true,
"moduleResolution": "node",
"noImplicitReturns": true,
"resolveJsonModule": true,
"noUnusedParameters": true,
"experimentalDecorators": true,
"useDefineForClassFields": true,
"noUncheckedIndexedAccess": true,
"exactOptionalPropertyTypes": true,
"forceConsistentCasingInFileNames": true,
"noPropertyAccessFromIndexSignature": false
},
"include": ["./**/*.ts"],
"exclude": ["dist", "node_modules"],
"$schema": "https://json.schemastore.org/tsconfig"
}

View File

@@ -4,6 +4,7 @@ on:
pull_request:
paths:
- '.github/workflows/release.yml'
- '.github/actions/publish-artifacts/**'
workflow_dispatch:
# From: https://github.com/rust-lang/rust-analyzer/blob/master/.github/workflows/release.yaml#L13-L21
@@ -19,12 +20,12 @@ jobs:
settings:
- host: macos-13
target: x86_64-apple-darwin
bundles: app,dmg
bundles: dmg,app
os: darwin
arch: x86_64
- host: macos-14
target: aarch64-apple-darwin
bundles: app,dmg
bundles: dmg,app
os: darwin
arch: aarch64
- host: windows-latest
@@ -101,7 +102,7 @@ jobs:
- name: Build
run: |
pnpm tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }},updater
pnpm tauri build --ci -v --target ${{ matrix.settings.target }} --bundles ${{ matrix.settings.bundles }}
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
@@ -141,7 +142,7 @@ jobs:
- name: Create Release
# TODO: Change to stable version when available
uses: softprops/action-gh-release@4634c16e79c963813287e889244c50009e7f0981
uses: softprops/action-gh-release@v2
with:
draft: true
files: '*/**'