-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: 'deploy' | ||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/**' | ||
- 'src/**' | ||
- 'build.gradle' | ||
- 'Dockerfile' | ||
- 'readme.md' | ||
- 'infraScript/**' | ||
branches: | ||
- 'main' | ||
jobs: | ||
makeTagAndRelease: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
tag_name: ${{ steps.create_tag.outputs.new_tag }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Create Tag | ||
id: create_tag | ||
uses: mathieudutour/github-tag-action@v6.1 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.create_tag.outputs.new_tag }} | ||
release_name: Release ${{ steps.create_tag.outputs.new_tag }} | ||
body: ${{ steps.create_tag.outputs.changelog }} | ||
draft: false | ||
prerelease: false | ||
buildImageAndPush: | ||
name: 도커 이미지 빌드와 푸시 | ||
needs: makeTagAndRelease | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Docker Buildx 설치 | ||
uses: docker/setup-buildx-action@v2 | ||
- name: 레지스트리 로그인 | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: set lower case owner name | ||
run: | | ||
echo "OWNER_LC=${OWNER,,}" >> ${GITHUB_ENV} | ||
env: | ||
OWNER: "${{ github.repository_owner }}" | ||
- name: application-secret.yml 생성 | ||
env: | ||
ACTIONS_STEP_DEBUG: true | ||
APPLICATION_SECRET: ${{ secrets.APPLICATION_SECRET_YML }} | ||
run: echo "$APPLICATION_SECRET" > src/main/resources/application-secret.yml | ||
- name: 빌드 앤 푸시 | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: | | ||
ghcr.io/${{ env.OWNER_LC }}/k8s-deploy-sb-2501:${{ needs.makeTagAndRelease.outputs.tag_name }}, | ||
ghcr.io/${{ env.OWNER_LC }}/k8s-deploy-sb-2501:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters