Skip to content

Commit

Permalink
Add simple gradle build
Browse files Browse the repository at this point in the history
  • Loading branch information
lyang committed May 6, 2024
1 parent 88d06d2 commit 2ec52c4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 20 deletions.
42 changes: 22 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
name: Build

on:
push:
branches: [ "main" ]

jobs:
docker-hub:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java-version: ["8", "11", "17", "21"]

steps:
- id: login
uses: docker/login-action@v3
with:
username: linyang1218
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: metadata
uses: docker/metadata-action@v5
- name: Checkout
uses: actions/checkout@v3

- name: Setup Java ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
images: linyang1218/puml
tags: |
type=sha,prefix=commit-,format=short,suffix=-{{date 'YYYYMMDD'}}
type=raw,value=latest,enable={{is_default_branch}}
- id: push
uses: docker/build-push-action@v5
distribution: 'temurin'
java-version: '${{ matrix.java-version }}'
cache: gradle

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
push: true
tags: ${{ steps.metadata.outputs.tags }}
gradle-version: wrapper

- name: Build
run: ./gradlew build

27 changes: 27 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Docker Image

on:
push:
branches: [ "main" ]

jobs:
docker-hub:
runs-on: ubuntu-latest
steps:
- id: login
uses: docker/login-action@v3
with:
username: linyang1218
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: metadata
uses: docker/metadata-action@v5
with:
images: linyang1218/puml
tags: |
type=sha,prefix=commit-,format=short,suffix=-{{date 'YYYYMMDD'}}
type=raw,value=latest,enable={{is_default_branch}}
- id: push
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.metadata.outputs.tags }}

0 comments on commit 2ec52c4

Please sign in to comment.