Skip to content

Commit

Permalink
CHANGELOGの更新をunreleasedフォルダ内で行うようにする (#666)
Browse files Browse the repository at this point in the history
* create pre-release workflow

* refactor

* fix

* time order

* 消し忘れ
  • Loading branch information
FineArchs authored May 17, 2024
1 parent 43ff2a9 commit f72da1b
Show file tree
Hide file tree
Showing 10 changed files with 202 additions and 99 deletions.
56 changes: 0 additions & 56 deletions .github/workflows/publish-nightly-next.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish nightly (dev)
name: Publish nightly

on:
schedule:
Expand All @@ -8,16 +8,22 @@ on:
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- branch: master
tag: dev
- branch: aiscript-next
tag: next
env:
NPM_SECRET: ${{ secrets.NPM_SECRET }}
BRANCH: master
TAG: dev

steps:
- name: Checkout
- name: Checkout ${{ matrix.branch }}
uses: actions/checkout@v4.1.5
with:
ref: ${{ env.BRANCH }}
ref: ${{ matrix.branch }}

- name: Setup Node.js
uses: actions/setup-node@v4.0.2
Expand All @@ -34,23 +40,23 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Set Version
run: |
CURRENT_VER=$(npm view 'file:.' version)
TIME_STAMP=$( date +'%Y%m%d' )
VERSION_SUFFIX=-$TAG.$TIME_STAMP
vim package.json '+/"version"' '+s/:\s*".*\zs\ze"/'$VERSION_SUFFIX/ '+wq'
echo 'NEWVERSION='$CURRENT_VER-${{ matrix.tag }}.$TIME_STAMP >> $GITHUB_ENV
- name: Check Commits
run: |
echo 'LAST_COMMITS='$( git log --since '24 hours ago' | wc -c ) >> $GITHUB_ENV
- name: Prepare Publish
run: npm run pre-release

- name: Publish
uses: JS-DevTools/npm-publish@v3
if: ${{ env.NPM_SECRET != '' && env.LAST_COMMITS != 0 }}
with:
token: ${{ env.NPM_SECRET }}
tag: ${{ env.TAG }}
tag: ${{ matrix.tag }}
access: public
14 changes: 0 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
[Read translated version (en)](./translations/en/CHANGELOG.md)

# 未リリース分
- `Date:year`系の関数に0を渡すと現在時刻になる問題を修正
- シンタックスエラーなどの位置情報を修正
- `arr.reduce`が空配列に対して初期値なしで呼び出された時、正式にエラーを出すよう
- `str.pad_start`,`str.pad_end`を追加
- `arr.insert`,`arr.remove`を追加
- `arr.sort`の処理を非同期的にして高速化
- `arr.flat`,`arr.flat_map`を追加
- `Uri:encode_full`, `Uri:encode_component`, `Uri:decode_full`, `Uri:decode_component`を追加
- `str.starts_with`,`str.ends_with`を追加
- `arr.splice`を追加
- 関数の省略された引数にNULLを格納するように
- 一時的な措置であり、省略可能引数構文の実装と同時に廃止予定です。依存し過ぎないようにしてください

# 0.18.0
- `Core:abort`でプログラムを緊急停止できるように
- `index_of`の配列版を追加
Expand Down
75 changes: 60 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"jest": "jest --coverage --detectOpenHandles",
"tsd": "tsd",
"test": "npm run jest"
"test": "npm run jest",
"pre-release": "node scripts/pre-release.mjs && npm run build",
"prepublishOnly": "node scripts/check-release.mjs"
},
"devDependencies": {
"@microsoft/api-extractor": "7.42.3",
Expand All @@ -49,6 +51,7 @@
"eslint-plugin-import": "2.29.1",
"jest": "29.7.0",
"peggy": "4.0.2",
"semver": "7.6.2",
"ts-jest": "29.1.2",
"ts-jest-resolver": "2.0.1",
"ts-node": "10.9.2",
Expand Down
8 changes: 8 additions & 0 deletions scripts/check-release.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { readdir } from 'node:fs/promises';

await readdir('./unreleased')
.then(pathes => {
if (pathes.length > 1 || (pathes.length === 1 && pathes[0] !== '.gitkeep')) throw new Error('Run "npm run pre-release" before publish.')
}, err => {
if (err.code !== 'ENOENT') throw err;
});
4 changes: 2 additions & 2 deletions scripts/gen-pkg-ts.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { writeFile } from 'node:fs/promises';
import pkg from '../package.json' assert { type: 'json' };
import { readFile, writeFile } from 'node:fs/promises';

const pkg = JSON.parse((await readFile('./package.json', 'utf8')));
await writeFile('./src/pkg.ts',
`/*
This file is automatically generated by scripts/gen-pkg-ts.js.
Expand Down
Loading

0 comments on commit f72da1b

Please sign in to comment.