-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,9 @@ on: | |
push: | ||
branches: | ||
- develop | ||
paths: | ||
- 'apps/api/**' | ||
- Fix/296 | ||
# paths: | ||
# - 'apps/api/**' | ||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
@@ -66,14 +67,39 @@ jobs: | |
- name: Checkout for docker-compose | ||
uses: actions/checkout@v2 | ||
|
||
- name: Copy docker-compose file | ||
uses: appleboy/scp-action@master | ||
# - name: Copy docker-compose file | ||
# uses: appleboy/scp-action@master | ||
# with: | ||
# host: ${{ secrets.SERVER_IP }} | ||
# username: ${{ secrets.SERVER_USER }} | ||
# key: ${{ secrets.SSH_SERVER_KEY }} | ||
# source: "docker-compose.yml" | ||
# target: "/home/${{ secrets.SERVER_USER }}/camon" | ||
|
||
- name: Create .env.api file | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.SERVER_IP }} | ||
username: ${{ secrets.SERVER_USER }} | ||
key: ${{ secrets.SSH_SERVER_KEY }} | ||
source: "docker-compose.yml" | ||
target: "/home/${{ secrets.SERVER_USER }}/camon" | ||
script: | | ||
cd /home/${{ secrets.SERVER_USER }}/camon | ||
cat << EOF > .env.api | ||
NCLOUD_REGISTRY_URL=${{ secrets.NCLOUD_REGISTRY_URL }} | ||
DB_HOST=${{ secrets.DB_HOST }} | ||
DB_PORT=${{ secrets.DB_PORT }} | ||
DB_USERNAME=${{ secrets.DB_USERNAME }} | ||
DB_PASSWORD=${{ secrets.DB_PASSWORD }} | ||
DB_NAME=${{ secrets.DB_NAME }} | ||
GH_CLIENT_ID=${{ secrets.GH_CLIENT_ID }} | ||
GH_SECRET=${{ secrets.GH_SECRET }} | ||
GH_CALLBACK_URL=${{ secrets.GH_CALLBACK_URL }} | ||
JWT_SECRET=${{ secrets.JWT_SECRET }} | ||
GG_CLIENT_ID=${{ secrets.GG_CLIENT_ID }} | ||
GG_SECRET=${{ secrets.GG_SECRET }} | ||
GG_CALLBACK_URL=${{ secrets.GG_CALLBACK_URL }} | ||
CALLBACK_URI=${{ secrets.CALLBACK_URI }} | ||
EOF | ||
- name: SSH and deploy | ||
uses: appleboy/[email protected] | ||
|
@@ -82,17 +108,16 @@ jobs: | |
username: ${{ secrets.SERVER_USER }} | ||
key: ${{ secrets.SSH_SERVER_KEY }} | ||
port: 22 | ||
envs: DB_HOST,DB_PORT,DB_USERNAME,DB_PASSWORD,DB_NAME,GH_CLIENT_ID,GH_SECRET,GH_CALLBACK_URL,JWT_SECRET,GG_CLIENT_ID,GG_SECRET,GG_CALLBACK_URL,CALLBACK_URI | ||
script: | | ||
cd /home/${{ secrets.SERVER_USER }}/camon | ||
sudo docker login -u ${{secrets.NCLOUD_ACCESS_KEY}} -p ${{ secrets.NCLOUD_SECRET_KEY }} ${{ secrets.NCLOUD_REGISTRY_URL }} | ||
sudo docker stop api-camon || true | ||
sudo docker rm api-camon || true | ||
sudo docker rmi ${{ secrets.NCLOUD_REGISTRY_URL }}/api-camon:latest || true | ||
sudo docker rmi ${NCLOUD_REGISTRY_URL}/api-camon:latest || true | ||
sudo docker pull ${{ secrets.NCLOUD_REGISTRY_URL }}/$IMAGE_NAME:latest | ||
sudo docker-compose up -d api | ||
sudo docker pull ${NCLOUD_REGISTRY_URL}/api-camon:latest | ||
sudo docker-compose --env-file .env.api up -d api | ||
sudo docker image prune -f | ||
- name: Check container status | ||
|
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
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