Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ jobs:
chmod 600 ~/.ssh/id_rsa
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa

- name: test connection
run: ssh -T jumphost@jumphost.kingscode.nl

<%_ if (options.plugins.includes('fontawesomepro')){ _%>
- name: build .npmrc
env:
Expand All @@ -38,26 +40,25 @@ jobs:
echo "@fortawesome:registry=https://npm.fontawesome.com/" >> .npmrc
echo "//npm.fontawesome.com/:_authToken=$FONT_AWESOME_TOKEN" >> .npmrc
<%_ } _%>

- name: build application environment
env:
CLIENT_ID: ${{ secrets.client_id }}
CLIENT_SECRET: ${{ secrets.client_secret }}
run: |
touch .env.production
echo "NODE_ENV=production" >> .env.production
echo "VUE_APP_ROOT_API=" >> .env.production
echo "VUE_APP_SENTRY=" >> .env.production
<%_ if (options.plugins.includes('analytics')) { _%>
echo "VUE_APP_ANALYTICS=" >> .env.production
<%_ } _%>
<%_ if (options.plugins.includes('sentry')) { _%>
echo "VUE_APP_ANALYTICS=" >> .env.production
echo "VUE_APP_SENTRY=" >> .env.production
<%_ } _%>
echo "VUE_APP_PUBLIC_PATH=/" >> .env.production
- name: build the environment

- name: build
run: |
npm ci
npm run build

- name: remove /old deployment and create /new folder for deployment
uses: appleboy/ssh-action@master
with:
Expand All @@ -68,25 +69,29 @@ jobs:
proxy_username: jumphost
proxy_key: ${{ secrets.private_key }}
script: |
shopt -s dotglob
cd ~/domains/example.com/public_html
rm -rf ./old
mkdir -p ./new
mkdir -p ./old

- name: deployment
run: |
cd dist
rsync -ave "ssh -o ProxyJump=jumphost@jumphost.kingscode.nl" ./ user@host:~/domains/example.com/public_html/new

- name: move previous deployment to ./old and move ./new deployment to ./
uses: appleboy/ssh-action@master
with:
host: host
username: user
key: ${{ secrets.private_key }}
proxy_host: jumphost.kingscode.nl
proxy_username: jumphost
proxy_key: ${{ secrets.private_key }}
script: |
cd ~/domains/example.com/public_html
mv `\ls -1 ./ | grep -v "\<new\>" | grep -v "\<old\>" | grep -v "\<api\>"` ./old
mv ./new/* ./
rm -rf ./new
uses: appleboy/ssh-action@master
with:
host: host
username: user
key: ${{ secrets.private_key }}
proxy_host: jumphost.kingscode.nl
proxy_username: jumphost
proxy_key: ${{ secrets.private_key }}
script: |
shopt -s dotglob
cd ~/domains/example.com/public_html
mv `\ls -1 ./ | grep -v "\<new\>" | grep -v "\<old\>" | grep -v "\<api\>"` ./old
mv ./new/* ./
rm -rf ./new
84 changes: 45 additions & 39 deletions generator/templates/Deployment/_github/workflows/deploy.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,74 +28,80 @@ jobs:
chmod 600 ~/.ssh/id_rsa
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa
- name: test connection

- name: test jumphost connection
run: ssh -T jumphost@jumphost.kingscode.nl
<%_ if (options.plugins.includes('fontawesomepro')){ _%>

<%_ if (options.plugins.includes('fontawesomepro')){ _%>
- name: build .npmrc
env:
FONT_AWESOME_TOKEN: ${{ secrets.font_awesome_token }}
run: |
echo "@fortawesome:registry=https://npm.fontawesome.com/" >> .npmrc
echo "//npm.fontawesome.com/:_authToken=$FONT_AWESOME_TOKEN" >> .npmrc
<%_ } _%>
<%_ } _%>

- name: build application environment
env:
CLIENT_ID: ${{ secrets.client_id }}
CLIENT_SECRET: ${{ secrets.client_secret }}
run: |
touch .env.production
echo "NODE_ENV=production" >> .env.production
echo "VUE_APP_ROOT_API=" >> .env.production
echo "VUE_APP_SENTRY=" >> .env.production
echo "VUE_APP_ANALYTICS=" >> .env.production
<%_ if (options.plugins.includes('analytics')) { _%>
echo "VUE_APP_ANALYTICS=" >> .env.production
<%_ } _%>
<%_ if (options.plugins.includes('sentry')) { _%>
echo "VUE_APP_ANALYTICS=" >> .env.production
<%_ } _%>echo "VUE_APP_PUBLIC_PATH=/" >> .env.production
<%_ if (!options.addRobotsFile){ _%>
echo "VUE_APP_SENTRY=" >> .env.production
<%_ } _%>
echo "VUE_APP_PUBLIC_PATH=/" >> .env.production

<%_ if (!options.addRobotsFile){ _%>
- name: setup robots.txt for disallowing search engines to visit the test env
run: |
cd public
touch robots.txt
echo "" > robots.txt
echo "User-agent: *" >> robots.txt
echo "Disallow: /" >> robots.txt
<%_ } _%>
- name: build the environment
<%_ } _%>

- name: build
run: |
npm ci
npm run build

- name: remove /old deployment and create /new folder for deployment
uses: appleboy/ssh-action@master
with:
host: host
username: user
key: ${{ secrets.private_key }}
proxy_host: jumphost.kingscode.nl
proxy_username: jumphost
proxy_key: ${{ secrets.private_key }}
script: |
cd ~/domains/example.com/public_html
rm -rf ./old
mkdir -p ./new
mkdir -p ./old
uses: appleboy/ssh-action@master
with:
host: host
username: user
key: ${{ secrets.private_key }}
proxy_host: jumphost.kingscode.nl
proxy_username: jumphost
proxy_key: ${{ secrets.private_key }}
script: |
shopt -s dotglob
cd ~/domains/example.com/public_html
rm -rf ./old
mkdir -p ./new
mkdir -p ./old

- name: deployment
run: |
cd dist
rsync -ave "ssh -o ProxyJump=jumphost@jumphost.kingscode.nl" ./ user@host:~/domains/example.com/public_html/new

- name: move previous deployment to ./old and move ./new deployment to ./
uses: appleboy/ssh-action@master
with:
host: host
username: user
key: ${{ secrets.private_key }}
proxy_host: jumphost.kingscode.nl
proxy_username: jumphost
proxy_key: ${{ secrets.private_key }}
script: |
cd ~/domains/example.com/public_html
mv `\ls -1 ./ | grep -v "\<new\>" | grep -v "\<old\>" | grep -v "\<api\>"` ./old
mv ./new/* ./
rm -rf ./new
uses: appleboy/ssh-action@master
with:
host: host
username: user
key: ${{ secrets.private_key }}
proxy_host: jumphost.kingscode.nl
proxy_username: jumphost
proxy_key: ${{ secrets.private_key }}
script: |
shopt -s dotglob
cd ~/domains/example.com/public_html
mv `\ls -1 ./ | grep -v "\<new\>" | grep -v "\<old\>" | grep -v "\<api\>"` ./old
mv ./new/* ./
rm -rf ./new