Skip to content

Publish Docker image #38

Publish Docker image

Publish Docker image #38

Workflow file for this run

name: Publish Docker image
on:
push:
tags:
- centraldogma-*
env:
LC_ALL: 'en_US.UTF-8'
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
if: github.repository == 'line/centraldogma'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build Docker image
run: ./gradlew :dist:docker --stacktrace
shell: bash
- name: Extract release version
id: release-version
uses: actions/github-script@v4
with:
# Extract a release version from 'refs/tags/centraldogma-x.y.z' tag.
script: |
const version = context.ref.replace(/.*centraldogma-/, '')
console.log('Release version: ' + version)
return version
result-encoding: string
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Docker image
run: |
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.release-version.outputs.result }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
shell: bash