-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
d623d1e
commit 7a8ad2e
Showing
1 changed file
with
16 additions
and
9 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 |
---|---|---|
|
@@ -12,9 +12,13 @@ jobs: | |
|
||
environment: | ||
name: ${{ github.ref == 'refs/heads/master' && 'production' || github.ref == 'refs/heads/development' && 'development' || '' }} | ||
|
||
build-and-deploy: | ||
|
||
steps: | ||
- name: Set up SSH | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
|
@@ -23,6 +27,11 @@ jobs: | |
with: | ||
node-version: '14' | ||
|
||
- name: Set up SSH | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SERVER_SSH_PRIVATE_KEY }} | ||
|
||
- name: Check Versions and Save to File | ||
run: | | ||
echo "git $(git --version)" > runtime-versions.txt | ||
|
@@ -42,18 +51,16 @@ jobs: | |
echo > redirects_pageid.txt | ||
- name: Deploy to Server | ||
with: | ||
SERVER_SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_PRIVATE_KEY }} | ||
run: | | ||
rsync -Waxvuk --delete site/ ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/opt/www/doc/ | ||
sync redirects.txt ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects.txt | ||
rsync redirects_pageid.txt ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects_pageid.txt | ||
rsync -Wxvuk --delete -e "ssh -i ${{ secrets.SERVER_SSH_PRIVATE_KEY }}" site/ "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/opt/www/doc/" | ||
rsync -e "ssh -i ${{ secrets.SERVER_SSH_PRIVATE_KEY }}" redirects.txt "${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects.txt" | ||
rsync -e "ssh -i ${{ secrets.SERVER_SSH_PRIVATE_KEY }}" redirects_pageid.txt ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}:/etc/nginx/redirects_pageid.txt | ||
- name: Nginx Config Test and Restart | ||
run: | | ||
ssh -i "${{ secrets.SERVER_SSH_PRIVATE_KEY }}" \ | ||
"${{ secrets.USERNAME }}@${{ secrets.SERVER_IP }}" \ | ||
"service nginx configtest && service nginx restart" | ||
"${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_IP }}" \ | ||
"service nginx configtest && service nginx restart" | ||
- name: Archive Artifacts | ||
uses: actions/upload-artifact@v3 | ||
|