Skip to content

Commit

Permalink
feat(deploy): added autopublish
Browse files Browse the repository at this point in the history
  • Loading branch information
andris9 committed Feb 23, 2024
1 parent 61597ea commit 3e8109f
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 11 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches:
- master

permissions:
contents: write
pull-requests: write
id-token: write

name: release
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
package-name: ${{vars.NPM_MODULE_NAME}}
pull-request-title-pattern: 'chore${scope}: release ${version} [skip-ci]'
# The logic below handles the npm publication:
- uses: actions/checkout@v4
# these if statements ensure that a publication only occurs when
# a new release is created:
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}
- run: npm ci
if: ${{ steps.release.outputs.release_created }}
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: ${{ steps.release.outputs.release_created }}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:
test:
strategy:
matrix:
node: [12.x, 14.x, 16.x, 18.x]
os: [ubuntu-latest, macos-latest, windows-latest]
node: [16.x, 18.x, 20.x, 21.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- run: npm install
Expand Down
7 changes: 7 additions & 0 deletions .ncurc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
upgrade: true,
reject: [
// 5x is esm only
'chai'
]
};
1 change: 1 addition & 0 deletions lib/charset.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const { Buffer } = require('node:buffer');
const iconv = require('iconv-lite');
const encodingJapanese = require('encoding-japanese');
const charsets = require('./charsets');
Expand Down
1 change: 1 addition & 0 deletions lib/libmime.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint no-control-regex: 0, no-div-regex: 0, quotes: 0 */
'use strict';

const { Buffer } = require('node:buffer');
const libcharset = require('./charset');
const libbase64 = require('libbase64');
const libqp = require('libqp');
Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,23 @@
],
"author": "Andris Reinman <[email protected]>",
"scripts": {
"test": "grunt"
"test": "grunt",
"update": "rm -rf node_modules package-lock.json && ncu -u && npm install"
},
"dependencies": {
"encoding-japanese": "2.0.0",
"iconv-lite": "0.6.3",
"libbase64": "1.2.1",
"libqp": "2.0.1"
"libbase64": "1.3.0",
"libqp": "2.1.0"
},
"devDependencies": {
"chai": "4.3.7",
"chai": "4.4.1",
"eslint-config-nodemailer": "1.2.0",
"eslint-config-prettier": "8.6.0",
"grunt": "1.5.3",
"eslint-config-prettier": "9.1.0",
"grunt": "1.6.1",
"grunt-cli": "1.4.3",
"grunt-eslint": "24.0.1",
"grunt-eslint": "24.3.0",
"grunt-mocha-test": "0.13.3",
"mocha": "10.2.0"
"mocha": "10.3.0"
}
}
34 changes: 34 additions & 0 deletions test/libmime-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

'use strict';

const { Buffer } = require('node:buffer');
const libmime = require('../lib/libmime');
const charset = require('../lib/charset');

Expand Down Expand Up @@ -307,6 +308,39 @@ describe('libmime', () => {
expect(libmime.parseHeaderValue(str)).to.deep.equal(obj);
});

it('should handle multi line ascii values', () => {
let str =
'text/plain;\n' +
'\tname*0=emailengine_uuendamise_kasud_ja_muud_asjad_ja_veelgi_pikem_pealk;\n' +
'\tname*1=iri.txt;\n' +
'\tx-apple-part-url=99AFDE83-8953-43B4-BE59-F59D6160AFAB',
obj = {
value: 'text/plain',
params: {
name: 'emailengine_uuendamise_kasud_ja_muud_asjad_ja_veelgi_pikem_pealkiri.txt',
'x-apple-part-url': '99AFDE83-8953-43B4-BE59-F59D6160AFAB'
}
};

expect(libmime.parseHeaderValue(str)).to.deep.equal(obj);
});

it.only('should handle ARC header from MS', () => {
let str =
'i=1; mx.microsoft.com 1; spf=fail (sender ip is 52.138.216.130) smtp.rcpttodomain=recipient.com smtp.mailfrom=sender.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=sender.com; dkim=none (message not signed); arc=none (0)',
obj = {
value: 'i=1',
params: {
'mx.microsoft.com 1; spf': 'fail (sender ip is 52.138.216.130) smtp.rcpttodomain=recipient.com smtp.mailfrom=sender.com',
dmarc: 'fail (p=reject sp=reject pct=100) action=oreject header.from=sender.com',
dkim: 'none (message not signed)',
arc: 'none (0)'
}
};

expect(libmime.parseHeaderValue(str)).to.deep.equal(obj);
});

it('should handle params only', () => {
let str = '; CHARSET= UTF-8; format=flowed;',
obj = {
Expand Down

0 comments on commit 3e8109f

Please sign in to comment.