[deploy] main code를 release 브랜치에 머지 시킵니다! (#156) #8
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: DEPLOY | |
on: | |
push: | |
branches: | |
- release/** | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Jdk 21 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Debug Secrets | |
run: | | |
echo "Secrets YML value:" | |
echo "${{ secrets.PROD_CONFIG }}" | |
- name: Push yml file | |
run: | | |
mkdir -p ./src/main/resources | |
cat <<EOF > ./src/main/resources/application-prod.yml | |
${{ secrets.PROD_CONFIG }} | |
EOF | |
echo "YML file successfully created" | |
- name: Build with Gradle | |
run: ./gradlew -x test clean build | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and Push Docker Image | |
run: | | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/ggang:latest . | |
docker push ${{ secrets.DOCKER_USERNAME }}/ggang:latest | |
- name: deploy appleboy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }} | |
docker pull ${{ secrets.DOCKER_USERNAME }}/ggang:latest | |
./deploy.sh | |
echo "now finished deploy: $(date '+%Y-%m-%d %H:%M:%S')" > deploy_success_date.txt |