Skip to content

Commit 7e433ca

Browse files
committed
Add code
1 parent c210239 commit 7e433ca

93 files changed

Lines changed: 1252 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @tmknom
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Container Build
2+
description: コンテナイメージをビルドし、ECRへプッシュします。
3+
inputs:
4+
ecr-repository-uri:
5+
required: true
6+
description: ECRリポジトリのURI
7+
dockerfile-path:
8+
required: true
9+
description: Dockerfileのパス
10+
outputs:
11+
container-image:
12+
value: ${{ steps.meta.outputs.tags }}
13+
description: ビルドしたコンテナイメージ
14+
runs:
15+
using: composite
16+
steps:
17+
- uses: aws-actions/amazon-ecr-login@v2 # Amazon ECRへのログイン
18+
- uses: docker/metadata-action@v5 # コンテナイメージのメタデータ生成
19+
id: meta
20+
with:
21+
images: ${{ inputs.ecr-repository-uri }}
22+
tags: type=sha,format=long
23+
- uses: docker/build-push-action@v5 # コンテナイメージのビルドとプッシュ
24+
with:
25+
push: true
26+
context: ${{ inputs.dockerfile-path }}
27+
tags: ${{ steps.meta.outputs.tags }}
28+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Container Deploy
2+
description: ECSサービスを更新し、コンテナをデプロイします。
3+
inputs:
4+
ecs-cluster:
5+
required: true
6+
description: ECSクラスター
7+
ecs-service:
8+
required: true
9+
description: ECSサービス
10+
task-definition:
11+
required: true
12+
description: タスク定義
13+
container-name:
14+
required: true
15+
description: コンテナ名
16+
container-image:
17+
required: true
18+
description: コンテナイメージ
19+
runs:
20+
using: composite
21+
steps:
22+
- run: | # タスク定義の取得
23+
aws ecs describe-task-definition --task-definition "${TASK_DEFINITION}" \
24+
--query taskDefinition --output json > "${RUNNER_TEMP}/task-def.json"
25+
env:
26+
TASK_DEFINITION: ${{ inputs.task-definition }}
27+
shell: bash
28+
- uses: aws-actions/amazon-ecs-render-task-definition@v1 # タスク定義の修正
29+
id: render
30+
with:
31+
task-definition: ${{ runner.temp }}/task-def.json
32+
container-name: ${{ inputs.container-name }}
33+
image: ${{ inputs.container-image }}
34+
- uses: aws-actions/amazon-ecs-deploy-task-definition@v1 # ECSサービスの更新
35+
with:
36+
cluster: ${{ inputs.ecs-cluster }}
37+
service: ${{ inputs.ecs-service }}
38+
task-definition: ${{ steps.render.outputs.task-definition }}

.github/actions/dump/action.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Dump # アクション名
2+
description: | # アクションの概要
3+
環境変数とgithubコンテキストをログへ出力します。
4+
ワークフローのデバッグに便利です。
5+
inputs: # アクションの入力
6+
enable-context:
7+
default: 'true'
8+
required: false
9+
description: コンテキストをログ出力するか
10+
outputs: # アクションの出力
11+
dumped-date:
12+
value: ${{ steps.current.outputs.date }}
13+
description: ダンプ日時
14+
runs:
15+
using: composite # アクションの実装方式
16+
steps: # アクションのメインロジック
17+
- run: printenv | sort
18+
shell: bash
19+
- run: echo "${CONTEXT}"
20+
if: ${{ inputs.enable-context == 'true' }}
21+
env:
22+
CONTEXT: ${{ toJSON(github) }}
23+
shell: bash
24+
- id: current
25+
run: echo "date=$(date)" >> "${GITHUB_OUTPUT}"
26+
shell: bash

.github/actions/hello/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: Hello
2+
description: ローカルアクション
3+
runs:
4+
using: composite
5+
steps:
6+
- run: echo "Hello"
7+
shell: bash

.github/dependabot-ignore.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
ignore: # バージョンアップの除外設定
8+
- dependency-name: actions/upload-artifact # 除外する依存関係の名前
9+
versions: # 除外対象のバージョン
10+
- 4.3.0
11+
- 4.3.1
12+
- dependency-name: 'actions/*' # アスタリスクは任意文字列にマッチ
13+
update-types: # 除外するバージョンアップの種類
14+
- version-update:semver-major

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions # パッケージエコシステム
4+
directory: / # パッケージマニフェストの配置先ディレクトリ
5+
schedule: # バージョンアップスケジュール
6+
interval: daily

.github/release-exclude.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
changelog:
2+
categories:
3+
- title: Enhancement
4+
labels:
5+
- enhancement
6+
exclude: # リリースノートの除外設定
7+
labels: # 除外するラベル
8+
- dependencies
9+
authors: # 除外するプルリクエスト作成者
10+
- dependabot

.github/release.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
changelog:
2+
categories: # リリースノートのカテゴリ設定
3+
- title: Enhancement # リリースノートへ「Enhancement」というカテゴリを作成する
4+
labels:
5+
- enhancement # 「Enhancement」へ掲載するプルリクエストのラベルを指定する
6+
- title: Bug Fixes
7+
labels: # プルリクエストのラベルは複数定義できる
8+
- bug
9+
- fixes

.github/scripts/bump.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
# GitHubからGitタグをまとめてフェッチして、最新バージョンを取り出す
4+
git fetch --tag 2>/dev/null
5+
version="$(git tag --sort=-v:refname | head -1 | sed 's/^v//')"
6+
7+
# 指定されたバージョンアップレベルに基づいて、新しいバージョンを算出
8+
IFS='.' read -ra tokens <<<"${version:-0.0.0}"
9+
major="${tokens[0]}"; minor="${tokens[1]}"; patch="${tokens[2]}"
10+
case "$1" in
11+
major) major="$((major + 1))"; minor=0; patch=0 ;;
12+
minor) minor="$((minor + 1))"; patch=0 ;;
13+
patch) patch="$((patch + 1))" ;;
14+
esac
15+
16+
# GitHubへフルバージョンタグとメジャーバージョンタグをプッシュ
17+
git tag "v${major}.${minor}.${patch}"
18+
git tag --force "v${major}" >/dev/null 2>&1
19+
git push --force --tags >/dev/null 2>&1
20+
echo "v${major}.${minor}.${patch}"

0 commit comments

Comments
 (0)