Skip to content

Commit

Permalink
Merge pull request #98 from averak/feature/94-build-docker-image-afte…
Browse files Browse the repository at this point in the history
…r-merge

マージ時にDockerイメージをビルドする
  • Loading branch information
averak authored Jan 17, 2024
2 parents 1eddd2a + 14d24b8 commit 7151db7
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 6 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build

on:
release:
types:
- created
pull_request:
branches:
- master
- develop

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: determine docker tag
id: docker_tag
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const tagExec = await exec.getExecOutput('git', ['describe', '--tags', '--abbrev=0']);
return tagExec.stdout || tagExec.stderr;
- name: build docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.docker_tag.outputs.result }}
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
Expand Down Expand Up @@ -50,8 +50,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17
Expand All @@ -65,10 +65,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: build docker image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
context: .
push: false

0 comments on commit 7151db7

Please sign in to comment.