Skip to content

ci: Fix auto-release #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .releaserc/release.config.js → .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* Semantic Release Config
*/

import fs from 'fs/promises';
import path from 'path';
import { readFile } from 'fs/promises';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';

// Get env vars
const ref = process.env.GITHUB_REF;
const ref = process.env.GITHUB_REF || '';
const serverUrl = process.env.GITHUB_SERVER_URL;
const repository = process.env.GITHUB_REPOSITORY;
const repositoryUrl = serverUrl + '/' + repository;
Expand Down Expand Up @@ -38,6 +39,7 @@ async function config() {
const config = {
branches: [
'master',
'ci/fix-auto-release',
// { name: 'alpha', prerelease: true },
// { name: 'beta', prerelease: true },
// 'next-major',
Expand All @@ -49,7 +51,7 @@ async function config() {
],
dryRun: true,
debug: true,
ci: true,
ci: false,
tagFormat: '${version}',
plugins: [
['@semantic-release/commit-analyzer', {
Expand Down Expand Up @@ -97,19 +99,17 @@ async function config() {

async function loadTemplates() {
for (const template of Object.keys(templates)) {
const text = await readFile(path.resolve(__dirname, resourcePath, templates[template].file));
const __dirname = dirname(fileURLToPath(import.meta.url));
const filePath = resolve(__dirname, resourcePath, templates[template].file);
const text = await readFile(filePath, 'utf-8');
templates[template].text = text;
}
}

async function readFile(filePath) {
return await fs.readFile(filePath, 'utf-8');
}

function getReleaseComment() {
const url = repositoryUrl + '/releases/tag/${nextRelease.gitTag}';
let comment = '🎉 This change has been released in version [${nextRelease.version}](' + url + ')';
return comment;
}

module.exports = config();
export default config();