Skip to content

update build workflow #2

update build workflow

update build workflow #2

Workflow file for this run

name: Build and push Docker image
on:
workflow_dispatch:
push:
branches:
- main
paths:
- '**.kt'
- '**.kts'
- 'gradle.properties'
- '.github/workflows/**'
- 'gradle/**'
- 'dockerfile'
pull_request:
branches:
- main
paths:
- '**.kt'
- '**.kts'
- 'gradle.properties'
- '.github/workflows/**'
- 'gradle/**'
- 'dockerfile'
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: ${{ vars.JVM_DISTRIBUTION }}
java-version: ${{ vars.JVM_VERSION }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Gradle Wrapper Validation
uses: gradle/actions/wrapper-validation@v3
- name: Check
run: ./gradlew check
build:
name: Build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
needs: check
steps:
- 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.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get repo name
id: get-repo
run: |
echo "repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
build-args: |
VERSION=${{ github.sha }}
push: true
tags: ghcr.io/${{ steps.get-repo.outputs.repo }}:latest
platforms: amd64