From 6b9e85acd62b131f04e98e99ccd9614efdf98854 Mon Sep 17 00:00:00 2001 From: rito528 <39003544+rito528@users.noreply.github.com> Date: Mon, 25 Mar 2024 01:37:58 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20docker-image=E3=83=AA=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E7=94=A8=E3=81=AECI=E3=82=92=E5=AE=9A=E7=BE=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-and-release.yml | 53 +++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/build-and-release.yml diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..2708b86 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,53 @@ +name: Build and release +on: + push: + branches: + - main + +env: + image_name: ghcr.io/giganticminecraft/seichiassist-downloader + +jobs: + build-image: + name: Build server docker image + runs-on: ubuntu-latest + outputs: + image_tag: ${{ steps.meta.outputs.tags }} + concurrency: + group: ${{ github.ref }}-docker-build + cancel-in-progress: true + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.image_name }} + tags: | + type=sha,prefix=sha-,suffix=,format=short + + - name: Build + id: docker_build + uses: docker/build-push-action@v5 + with: + push: true + context: ./server + file: ./Dockerfile + builder: ${{ steps.buildx.outputs.name }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + # すべてのビルドステージのすべてのレイヤーをキャッシュして欲しいのでmode=max + cache-to: type=gha,mode=max