Skip to content

Commit

Permalink
upgrade semantic release
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza committed Oct 20, 2024
1 parent f211b99 commit 3b3216b
Show file tree
Hide file tree
Showing 4 changed files with 2,880 additions and 2,684 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/release-automated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,21 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.1.0
registry-url: https://registry.npmjs.org/
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- run: npm ci
- run: npx semantic-release
node-version: 22
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run semantic-release
run: npx semantic-release
env:
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
20 changes: 10 additions & 10 deletions release.config.js → .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
*/

// For CommonJS use:
// const { readFile } = require('fs').promises;
// const { resolve } = require('path');
const { readFile } = require('fs').promises;
const { resolve } = require('path');

// For ES6 modules use:
import { readFile } from 'fs/promises';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
// import { readFile } from 'fs/promises';
// import { resolve, dirname } from 'path';
// import { fileURLToPath } from 'url';

// Get env vars
const ref = process.env.GITHUB_REF;
Expand Down Expand Up @@ -106,8 +106,8 @@ async function config() {
async function loadTemplates() {
for (const template of Object.keys(templates)) {
// For ES6 modules use:
const fileUrl = import.meta.url;
const __dirname = dirname(fileURLToPath(fileUrl));
// const fileUrl = import.meta.url;
// const __dirname = dirname(fileURLToPath(fileUrl));

const filePath = resolve(__dirname, resourcePath, templates[template].file);
const text = await readFile(filePath, 'utf-8');
Expand All @@ -117,12 +117,12 @@ async function loadTemplates() {

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

// For CommonJS use:
// module.exports = config();
module.exports = config();

// For ES6 modules use:
export default config();
// export default config();
Loading

0 comments on commit 3b3216b

Please sign in to comment.