Skip to content

Instantly share code, notes, and snippets.

@ram0973
Created December 19, 2024 07:03
Show Gist options
  • Select an option

  • Save ram0973/088dea6c58f1328ba59aa7077fca4d20 to your computer and use it in GitHub Desktop.

Select an option

Save ram0973/088dea6c58f1328ba59aa7077fca4d20 to your computer and use it in GitHub Desktop.
name: Build
on:
- push
- pull_request
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: self-hosted #ubuntu-22.04
steps:
- uses: actions/checkout@v4.2.2
- uses: actions/setup-java@v4.6.0
with:
distribution: 'liberica'
java-version: '23'
cache: 'gradle'
- run: chmod +x ./gradlew
- run: make setup
- run: make build
- run: make test
deploy:
needs: build
runs-on: self-hosted #ubuntu-22.04
permissions:
contents: read
packages: write
if: ${{ github.event_name == 'push' }}
steps:
- uses: actions/checkout@v4.2.2
#- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
file: ./docker/spring/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment