cd git actions 작성 #27
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: Dev deploy | ||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '11' | ||
- name: Gradle Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
- name: Build with gradle | ||
run : ./gradlew clean build -x test | ||
- name: Build Docker image | ||
run: | | ||
Check failure on line 42 in .github/workflows/deploy-dev.yml GitHub Actions / Dev deployInvalid workflow file
|
||
docker login -u ${{ secrets.DOCKERHUB_ID }} -p ${{ secrets.DOCKERHUB_PASSWORD }} | ||
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/mju-graduate-server:v2 \ | ||
--build-arg DATASOURCE_URL=${{ DATASOURCE_URL }} \ | ||
--build-arg DATASOURCE_USERNAME=${{ DATASOURCE_USERNAME }} \ | ||
--build-arg DATASOURCE_PASSWORD=${{ JWT_SECRET }} | ||
docker push ${{ secrets.DOCKERHUB_USERNAME }}/mju-graduate-server:v2 | ||
- name: Docker Deploy executing remote ssh commands using ssh_key | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.WAS_HOST }} | ||
username: ${{ secrets.WAS_USERNAME }} | ||
key: ${{ secrets.WAS_KEY }} | ||
script : | | ||
cd ~/mju-graduate-server | ||
docker stop $(docker ps -a -q) | ||
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/mju-graduate-server:v2 | ||
docker rm -f $(docker ps -a -q) | ||
docker run -d --name mju-graduate-api-server -p 8080:8080 ${{ secrets.DOCKER_USERNAME }}/mju-graduate-server:v2 |