mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-12 18:15:48 +00:00
fix(ci): align stable release runner
This commit is contained in:
1 parent
ae4603c50c
commit
4458774d5c
2 files changed
+35
-1
No files matched your search
@@ -8,7 +8,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
if: ${{ github.ref == 'refs/heads/main' }}
|
if: ${{ github.ref == 'refs/heads/main' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: [self-hosted, linux, x64]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { describe, expect, test } from 'bun:test';
|
||||||
|
import * as fs from 'node:fs';
|
||||||
|
import * as path from 'node:path';
|
||||||
|
|
||||||
|
function resolvePath(relativePath: string) {
|
||||||
|
return path.resolve(import.meta.dir, relativePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('stable release workflow', () => {
|
||||||
|
test('uses the protected-branch runner and release token path', () => {
|
||||||
|
const workflowPath = resolvePath('../../../../.github/workflows/release.yml');
|
||||||
|
|
||||||
|
expect(fs.existsSync(workflowPath)).toBe(true);
|
||||||
|
|
||||||
|
const workflow = fs.readFileSync(workflowPath, 'utf8');
|
||||||
|
const checkoutSection = workflow.slice(
|
||||||
|
workflow.indexOf('- name: Checkout code'),
|
||||||
|
workflow.indexOf('- name: Setup Node.js')
|
||||||
|
);
|
||||||
|
const releaseSection = workflow.slice(
|
||||||
|
workflow.indexOf('- name: Release'),
|
||||||
|
workflow.indexOf('- name: Notify Discord')
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(workflow).toContain('name: Release');
|
||||||
|
expect(workflow).toContain('branches: [main]');
|
||||||
|
expect(workflow).toContain('runs-on: [self-hosted, linux, x64]');
|
||||||
|
expect(workflow).not.toContain('runs-on: ubuntu-latest');
|
||||||
|
expect(checkoutSection).toContain('token: ${{ secrets.PAT_TOKEN }}');
|
||||||
|
expect(releaseSection).toContain('GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}');
|
||||||
|
expect(releaseSection).toContain('GH_TOKEN: ${{ secrets.PAT_TOKEN }}');
|
||||||
|
expect(releaseSection).toContain('NPM_TOKEN: ${{ secrets.NPM_TOKEN }}');
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in new issue
Block a user