Skip to content
This repository has been archived by the owner on Jan 17, 2024. It is now read-only.

Commit

Permalink
fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
tamaina authored Jan 16, 2024
1 parent db341ce commit 9cc84b3
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHANGES_TEMPLATE: "## 202x.x.x (Unreleased)\n\n### General\n- \n\n### Client\n- \n\n### Server\n- \n"
CHANGES_TEMPLATE: |
## 202x.x.x (Unreleased)
### General
-
### Client
-
### Server
-
name: "Release Manager"

Expand Down Expand Up @@ -31,7 +41,9 @@ jobs:
- uses: actions/checkout@v4
# jqでpackage.jsonから現在のバージョンを取得
- name: Get current version
run: echo "current_version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
run: |
jq -r '.version' package.json
echo "current_version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
id: get_current_version
# バージョンをインクリメント
- name: Increment version
Expand All @@ -43,11 +55,13 @@ jobs:
const now = new Date();
const year = now.toLocaleDateString('en-US', { year: 'numeric', timeZone: 'Asia/Tokyo' });
const month = now.toLocaleDateString('en-US', { month: 'numeric', timeZone: 'Asia/Tokyo' });
const [major, minor, patch] = process.env.CURRENT_VERSION.split('.');
const [major, minor, _patch] = process.env.CURRENT_VERSION.split('.');
const patch = Number(_patch.split('-')[0]);
if (patch.isNaN()) throw new Error('Invalid patch version');
if (year !== major || month !== minor) {
return `${year}.${month}.0`;
} else {
return `${major}.${minor}.${Number(patch) + 1}`;
return `${major}.${minor}.${patch + 1}`;
}
result-encoding: string
id: increment_version
Expand All @@ -62,6 +76,7 @@ jobs:
sed -n '/## 202x.x.x (Unreleased)/,/^## /p' CHANGELOG.md | sed -e 1d -e '$d'
id: changelog
# CHANGELOG.mdのバージョンの書き換え
# 環境変数から挿入する部分: https://qiita.com/sahayan/items/8658992f0f48eb5d2bc4
- name: Modify CHANGELOG.md
run: |
sed -i 's/## 202x.x.x (Unreleased)/## ${{ steps.increment_version.outputs.result }}/' CHANGELOG.md
Expand Down

0 comments on commit 9cc84b3

Please sign in to comment.