최종 테스트 #116
Workflow file for this run
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
name: Build and Deploy to EC2 | ||
on: | ||
push: | ||
branches: [ "production", "main", "feat/173-docker-deploy" ] | ||
pull_request: | ||
branches: [ "production", "main" ] | ||
jobs: | ||
backend-docker-build-and-push: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
# 프로젝트 내 yml 파일 실행 | ||
- name: make application.yml | ||
run: | | ||
mkdir -p ./src/main/resources | ||
cd ./src/main/resources | ||
touch ./application.yml | ||
touch ./application-common.yml | ||
touch ./application-prod.yml | ||
echo "${{ secrets.APPLICATION }}" > ./application.yml | ||
echo "${{ secrets.COMMON }}" > ./application-common.yml | ||
echo "${{ secrets.PROD }}" > ./application-prod.yml | ||
- name: make test application.yml | ||
run: | | ||
mkdir -p ./src/test/resources | ||
cd ./src/test/resources | ||
touch ./application.yml | ||
touch ./application-test.yml | ||
echo "${{ secrets.APPLICATION_TEST }}" > ./application.yml | ||
echo "${{ secrets.TEST }}" > ./application-test.yml | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
shell: bash | ||
- name: Build with Gradle | ||
run: ./gradlew clean build | ||
- name: docker login | ||
uses: docker /login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: docker image build | ||
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/gitget-application . | ||
- name: dockerhub push | ||
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/gitget-application | ||
run-docker-image-on-ec2: | ||
needs: build-docker-image | ||
Check failure on line 68 in .github/workflows/main.yml GitHub Actions / Build and Deploy to EC2Invalid workflow file
|
||
runs-on: self-hosted | ||
steps: | ||
- name: execute deploy.sh | ||
run: sh /home/ec2-user/deploy.sh |