Skip to content

Commit

Permalink
separate build Action
Browse files Browse the repository at this point in the history
  • Loading branch information
ShotaKitazawa authored and shota-kitazawa committed May 3, 2024
1 parent f3785eb commit 5a38b3b
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: build dreamkast-weaver image
name: build dreamkast-weaver image when branches are pushed

on: push
on:
push:
branches: ["*"]

jobs:
build:
Expand All @@ -18,7 +20,7 @@ jobs:
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1
aws-region: us-west-2

- name: Login to Amazon ECR
id: login-ecr
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/build-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: build dreamkast-weaver image when tags are pushed

on:
push:
tags: ["*"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.login-ecr.outputs.registry }}/dreamkast-weaver
tags: |
type=sha,prefix=,format=long
type=ref,event=tag
- name: Build
id: docker_build
uses: docker/build-push-action@v5
with:
context: ./
file: Dockerfile
builder: ${{ steps.buildx.outputs.name }}
push: true
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 5a38b3b

Please sign in to comment.