Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/workflows/auto-build.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/auto-labeling.yml

This file was deleted.

49 changes: 0 additions & 49 deletions .github/workflows/auto-release.yml

This file was deleted.

118 changes: 118 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Release action
run-name: Release action

on:
workflow_dispatch:
inputs:
bump-level:
type: choice
options: [patch, minor, major]
required: true
description: Bump to patch or minor or major version

jobs:
# 新しいタグをリリース
release:
timeout-minutes: 5
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.bump.outputs.new_version }}
# GITHUB_TOKENに付与される権限を設定
permissions:
## readだとエラーが出るっぽい
contents: write
# 実行するステップを定義
steps:
- uses: actions/checkout@v4

- id: bump
name: Bump version and tag repository
env:
USERNAME: github-actions[bot]
EMAIL: github-actions[bot]@users.noreply.github.com
BUMP_LEVEL: ${{ inputs.bump-level }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "${USERNAME}"
git config --global user.email "${EMAIL}"
version="$(.github/scripts/bump.sh "${BUMP_LEVEL}")"
echo "New version: ${version}"
echo "new_version=${version}" >> $GITHUB_OUTPUT

# リリースしたタグを元にdockerイメージをビルドしてpushする
build-and-push:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
include:
- context: api
dockerfile: api/Dockerfile
image: seeds/seeds-api
- context: view
dockerfile: view/Dockerfile
image: seeds/seeds-view

steps:
# リポジトリのチェックアウト
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Create .env file from Secrets
run: echo "${{ secrets.PROD_ENV }}" > .env

# .envファイルの内容をbuild-argsとして利用できるように整形
- name: Generate build args from .env
id: build_args
run: |
echo "ARGS<<EOF" >> $GITHUB_OUTPUT
cat .env >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

# arm64アーキテクチャのビルドを行う場合は、以下のコメントアウトを解除してください
# # QEMUエミュレーションのセットアップ
# - name: Set up QEMU for multi-arch
# uses: docker/setup-qemu-action@v3 # QEMU エミュレーション

# Docker Buildxのセットアップ
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
buildkitd-flags: --debug

- name: Docker Login
uses: docker/login-action@v3
with:
registry: ${{ secrets.HARBOR_REG }}
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_PASS }}

# Docker Buildxを使用してマルチアーキテクチャのDockerイメージをビルドし、プッシュ
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ${{ matrix.context }}
file: ${{ matrix.dockerfile }}
platforms: linux/amd64
# platforms: linux/arm64,linux/amd64
pull: true
push: true
tags: |
${{ secrets.HARBOR_REG }}/${{ matrix.image_name }}:${{ needs.release.outputs.tag }}
${{ secrets.HARBOR_REG }}/${{ matrix.image_name }}:latest
build-args: ${{ steps.build_args.outputs.ARGS }}
cache-from: |
type=gha,scope=${{ matrix.image_name }}-cache
type=registry,ref=${{ secrets.HARBOR_REG }}/${{ matrix.image_name }}:cache
cache-to: |
type=gha,mode=max,scope=${{ matrix.image_name }}-cache
type=registry,ref=${{ secrets.HARBOR_REG }}/${{ matrix.image_name }}:cache,mode=max,image-manifest=true

# Docker Buildxのキャッシュをプルーニング
- name: Prune Buildx builder and caches
if: always()
run: |
docker buildx prune --all --force
15 changes: 0 additions & 15 deletions .github/workflows/release.yml

This file was deleted.