Skip to content

Commit

Permalink
add action file
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonuphiller committed Nov 18, 2024
1 parent ae820dd commit 5aa00d8
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/prd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Build and Push Docker Image for PRD
on:
push:
branches:
- main

jobs:
build-and-push-image:
runs-on: ubuntu-latest
environment: prd
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew clean build

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.HUB_USERNAME }}
password: ${{ secrets.HUB_PASSWORD }}

- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYYMMDDTHHmm
utcOffset: "+09:00"

- name: Build, tag, and push image to Docker Hub
id: build-image
run: |
docker build -t ${{ secrets.HUB_URI }}:${{steps.current-time.outputs.formattedTime}} .
docker push ${{ secrets.HUB_URI }}:${{steps.current-time.outputs.formattedTime}}

0 comments on commit 5aa00d8

Please sign in to comment.