Merge pull request #56 from GiganticMinecraft/renovate/actions-checko… #27
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: Build and publish seichiassist-builder docker image | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'seichiassist-builder/**' | |
- '.github/workflows/publish-seichiassist-builder.yml' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
env: | |
image_name: seichiassist-builder | |
# 参考: https://qiita.com/kawakawaryuryu/items/b0291c1bc1141a535263 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- id: prepare_image_id | |
name: Prepare image id's components | |
run: | | |
lowercase_id=ghcr.io/${{ github.repository_owner }}/${{ env.image_name }} | |
echo "::set-output name=lowercase_id::$(echo $lowercase_id | tr '[A-Z]' '[a-z]')" | |
echo "::set-output name=short-ref::$(git rev-parse --short "$GITHUB_SHA")" | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./seichiassist-builder | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
tags: | | |
${{ steps.prepare_image_id.outputs.lowercase_id }}:latest | |
${{ steps.prepare_image_id.outputs.lowercase_id }}:${{ steps.prepare_image_id.outputs.short-ref }} | |
cache-from: type=gha | |
# すべてのビルドステージのすべてのレイヤーをキャッシュして欲しいのでmode=max | |
cache-to: type=gha,mode=max |