Skip to content

build: deploy workflow 추가 #9

build: deploy workflow 추가

build: deploy workflow 추가 #9

Workflow file for this run

name: frontend deploy
on:
push:
branches:
- feat/36
jobs:
docker_image_pull:

Check failure on line 8 in .github/workflows/deploy.yml

View workflow run for this annotation

GitHub Actions / frontend deploy

Invalid workflow file

The workflow is not valid. .github/workflows/deploy.yml (Line: 8, Col: 3): The workflow must contain at least one job with no dependencies.
name: Connect server ssh and pull from container registry
needs: docker_image_push
runs-on: ubuntu-latest
steps:
- name: Setting NCP CLI & Credentials
run: |
cd ~
mkdir -p ~/cli_linux
cd ~/cli_linux
wget https://www.ncloud.com/api/support/download/5/65
unzip 65
mkdir ~/.ncloud
echo -e "[DEFAULT]\nncloud_access_key_id = ${{ secrets.NCP_ACCESS_KEY }}\nncloud_secret_access_key = ${{ secrets.NCP_SECRET_KEY }}\nncloud_api_url = ${{ secrets.NCP_SERVER_HOST }}" >> ~/.ncloud/configure
- name: Add Github Action Ip to Security group
run: |
ls
chmod -R 777 ~/cli_linux
cd ~/cli_linux
./ncloud vserver addAccessControlGroupInboundRule --regionCode KR --vpcNo ${{ secrets.NCP_VPC_ID }} --accessControlGroupNo ${{ secrets.NCP_AGC_ID }} --accessControlGroupRuleList "protocolTypeCode='TCP', ipBlock='${{ steps.ip.outputs.ipv4 }}/32', portRange='${{ secrets.SSH_PORT }}'"
- name: Connect SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.NCP_SERVER_HOST }}
username: ${{ secrets.NCP_SERVER_USERNAME }}
password: ${{ secrets.NCP_SERVER_PASSWORD }}
port: ${{ secrets.NCP_SERVER_PORT }}
script: |
docker pull ${{ secrets.CONTAINER_REGISTRY_URL }}/tag-name
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker run -d -p 3000:80 --env-file ${{ secrets.ENV_FILENAME_FRONTEND }} ${{ secrets.CONTAINER_REGISTRY_URL }}/tag-name
docker image prune -f
- name: Remove Github Action Ip to Security group
run: |
chmod -R 777 ~/cli_linux
cd ~/cli_linux
./ncloud vserver removeAccessControlGroupInboundRule --regionCode KR --vpcNo ${{ secrets.NCP_VPC_ID }} --accessControlGroupNo ${{ secrets.NCP_AGC_ID }} --accessControlGroupRuleList "protocolTypeCode='TCP', ipBlock='${{ steps.ip.outputs.ipv4 }}/32', portRange='${{ secrets.SSH_PORT }}'"