Fix: [Server][Channel] typo を修正 #784
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
name: Publish Docker Image | |
# master ブランチに変更があったとき or タグが作成されたとき or 手動実行 | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
# ジョブの定義 | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
# 最新コミットがリリースコミットのときは、タグの push がトリガーのとき以外は実行しない | |
## タグが push された後でないと Releases からサードパーティーライブラリをダウンロードできず失敗する | |
if: (startsWith(github.ref, 'refs/tags/v')) || (contains(github.event.head_commit.message, 'Release:') == false) | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# タグの push がトリガーのときだけ、Release のサードパーティーライブラリが確実にアップロードされるまで1分ほど待つ | |
- name: Wait for Release to be Created | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
sleep 60s | |
# GitHub Container Registry (ghcr.io) にログイン | |
- name: Login to the Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Docker イメージのタグ付け用のメタデータを抽出 | |
- name: Extract Metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=ref,event=tag | |
# Docker イメージをビルドして公開 | |
- name: Build and Push Docker Image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# おそらく使われることのない、Untagged なイメージをすべて削除する | |
# ref: https://github.com/vlaurin/action-ghcr-prune | |
- name: Prune Untagged Docker Images | |
uses: vlaurin/[email protected] | |
with: | |
token: ${{ secrets.DELETE_GHCR_IMAGES_TOKEN }} | |
container: konomitv | |
dry-run: false | |
prune-untagged: true |