CI: SSH , SCP action에 retry하도록 수정 #70
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
on: | ||
# DEBUG: For test only | ||
pull_request: | ||
branches: | ||
- develop | ||
push: | ||
branches: | ||
- develop | ||
paths: | ||
- docker-compose-backend.yml | ||
- Dockerfile | ||
- gradle.properties | ||
- gradlew | ||
- gradlew.bat | ||
- build.gradle.kts | ||
- settings.gradle.kts | ||
- src/** | ||
- gradle/** | ||
- .github/workflows/deploy_dev.yaml | ||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup Java JDK | ||
uses: actions/[email protected] | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
- run: ./gradlew test bootJar | ||
- name: Log in to the Container Registry | ||
uses: docker/[email protected] | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
with: | ||
context: . | ||
push: true | ||
build-args: | | ||
PROFILE=dev | ||
tags: | | ||
ghcr.io/wafflestudio/csereal-server/server_image:dev | ||
ghcr.io/wafflestudio/csereal-server/server_image:${{github.sha}} | ||
- name: Create .env file | ||
run: | | ||
echo "PROFILE=dev" > .env | ||
echo "MYSQL_ROOT_PASSWORD=${{secrets.MYSQL_ROOT_PASSWORD}}" >> .env | ||
echo "MYSQL_USER=${{secrets.MYSQL_USER}}" >> .env | ||
echo "MYSQL_PASSWORD=${{secrets.MYSQL_PASSWORD}}" >> .env | ||
echo "MYSQL_DATABASE=${{secrets.MYSQL_DATABASE}}" >> .env | ||
echo "OIDC_CLIENT_SECRET_DEV=${{secrets.OIDC_CLIENT_SECRET_DEV}}" >> .env | ||
echo "URL=${{secrets.URL_DEV}}" >> .env | ||
# echo "SLACK_TOKEN=${{secrets.SLACK_TOKEN}}" >> .env | ||
# echo "SLACK_CHANNEL=${{secrets.SLACK_CHANNEL}}" >> .env | ||
- name: SCP Command to Transfer Files | ||
uses: Wandalen/wretry.action@master | ||
with: | ||
- action: appleboy/[email protected] | ||
Check failure on line 73 in .github/workflows/deploy_dev.yaml GitHub Actions / .github/workflows/deploy_dev.yamlInvalid workflow file
|
||
attempt_limit: 3 | ||
attempt_delay: 2000 | ||
with: | | ||
host: ${{secrets.SSH_HOST_DEV}} | ||
username: ${{secrets.SSH_USER}} | ||
key: ${{secrets.SSH_KEY}} | ||
source: "docker-compose-backend.yml, .env" | ||
target: "~/app" | ||
overwrite: true | ||
- name: SSH Remote Commands | ||
uses: Wandalen/wretry.action@master | ||
with: | ||
- action: appleboy/[email protected] | ||
attempt_limit: 3 | ||
attempt_delay: 2000 | ||
with: | | ||
host: ${{secrets.SSH_HOST_DEV}} | ||
username: ${{secrets.SSH_USER}} | ||
key: ${{secrets.SSH_KEY}} | ||
script: | | ||
cd ~/app | ||
source .env | ||
docker-compose -f docker-compose-backend.yml down | ||
docker-compose -f docker-compose-backend.yml pull | ||
docker-compose -f docker-compose-backend.yml up -d |