-
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.
[chore][#17]github action CI/CD workflow 설정
- Loading branch information
Showing
2 changed files
with
86 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,62 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created | ||
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle | ||
|
||
name: Gradle Package | ||
|
||
on: | ||
pull_request: | ||
branches: ["master"] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: create application-aws.yml | ||
run: | ||
mkdir ./src/main/resources | ||
cd ./src/main/resources | ||
|
||
touch ./application-aws.yml | ||
|
||
echo "${{ secrets.YML-AWS }}" >> ./application-aws.yml | ||
|
||
cat ./application-aws.yml | ||
|
||
|
||
- name: build | ||
run: | | ||
chmod +x gradlew | ||
./gradlew build -x test | ||
- name: Docker hub login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_ID }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
|
||
- name: Docker image build | ||
run: | | ||
docker build -t ${{secrets.DOCKERHUB_ID}}/Cheada-spring . | ||
- name: Docker Hub push | ||
run: docker push ${{secrets.DOCKERHUB_ID}}/Cheada-spring | ||
|
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,24 @@ | ||
name: deploy-spring-server | ||
on: | ||
push: | ||
branches: master | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Deploy spring MainServer(master) | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SERVER_HOST }} | ||
username: ${{ secrets.SERVER_USERNAME }} | ||
key: ${{ secrets.SERVER_KEY }} | ||
script: | | ||
cd ~/Desktop/ChaeDa_spring | ||
git fetch origin master | ||
git merge origin/master | ||
./gradlew build | ||
docker rm desktop_back_1 --force | ||
docker rmi desktop_back | ||
cd .. | ||
docker-compose up -d |