-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: ReleaseブランチにPRが作成されたときにタグの候補名を自動的に出力するようにした
- Loading branch information
Showing
7 changed files
with
98 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/.env.local | ||
/bcrypt-hash.txt | ||
/flyio.Dockerfile | ||
/git-tags.txt | ||
# テストを実行すると./__uploader_for_tests__ディレクトリに画像ファイルが生成される。もしアップローダーのテストが失敗するとこれらが残ることがあるため、除外している。 | ||
/__uploader_for_tests__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import dayjs from 'dayjs'; | ||
import timezone from 'dayjs/plugin/timezone'; | ||
import utc from 'dayjs/plugin/utc'; | ||
import fs from 'fs-extra'; | ||
import WebPackageJson from '../../web-server/package.json'; | ||
import { VERSION } from './VERSION'; | ||
|
||
// timezone プラグインを使う場合は utc プラグインも必要らしい - https://day.js.org/docs/en/timezone/timezone | ||
dayjs.extend(utc); | ||
dayjs.extend(timezone); | ||
|
||
const main = (): void => { | ||
// API サーバーのバージョンは @flocon-trpg/api-server の TypeScript コードから取得する必要がある一方で、それ以外のバージョンは TypeScript コードを必要としない。そのため、これは API サーバー以外のタグ名も全て生成するスクリプトではあるが、@flocon-trpg/api-server 内に置いている。 | ||
|
||
const version = VERSION.toString(); | ||
const apiServerTag = `api/v${version}`; | ||
const webServerTag = `web/v${WebPackageJson.version}`; | ||
|
||
// GitHub Actions などで実行されることがあるため、明示的にタイムゾーンを指定している | ||
const date = dayjs().tz('Asia/Tokyo').format('YY.M.D'); | ||
|
||
// * の部分は同じ日時に複数のタグがあるときに区別するのが目的の数値。この部分は自動的には生成できないので自分で手動で入力する | ||
const mainTag = `v${date}.*`; | ||
|
||
const txt = `Main: ${mainTag} | ||
Web Server: ${webServerTag} | ||
API Server: ${apiServerTag}`; | ||
|
||
fs.writeFileSync('./git-tags.txt', txt); | ||
}; | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters