-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (45 loc) · 1.75 KB
/
publish-seichiassist-runner-v2.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Build and publish seichiassist-runner docker image
on:
push:
branches:
- main
paths:
- 'seichiassist-runner-v2/**'
- '.github/workflows/publish-seichiassist-runner-v2.yml'
jobs:
build-and-push:
runs-on: ubuntu-latest
env:
image_name: seichiassist-runner-v2
# 参考: https://qiita.com/kawakawaryuryu/items/b0291c1bc1141a535263
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # 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-runner-v2
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