Merge pull request #30 from interflux-electronics/feature/icsf-suppliers #278
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: Continuous Deployment | |
on: | |
push: | |
branches: | |
- 'production' | |
concurrency: | |
group: ci-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 14.x | |
cache: yarn | |
- run: echo "HOST=interflux.com" > .env | |
- run: echo "LANGUAGE=en" >> .env | |
- run: echo "PORT=4700" >> .env | |
- run: yarn install --frozen-lockfile | |
- run: yarn test | |
deploy-com: | |
name: Deploy interflux.com (Frankfurt) | |
runs-on: ubuntu-latest | |
needs: test | |
env: | |
SSH: ${{secrets.FRANKFURT_SSH}} | |
URL: admin@frankfurt.server.interflux.com | |
ROOT: /var/www/interflux.com | |
# Use the same ssh-agent socket value across all jobs | |
# Useful when a GH action is using SSH behind-the-scenes | |
# Inspired from: | |
# https://stackoverflow.com/questions/64953274/how-to-send-passphrase-for-ssh-add-with-github-actions | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
steps: | |
- uses: actions/checkout@v2 | |
- run: mkdir ~/.ssh | |
- run: 'echo "$SSH" > ~/.ssh/$URL' | |
- run: 'echo "IdentityFile ~/.ssh/$URL" > ~/.ssh/config' | |
- run: ssh-keyscan -H frankfurt.server.interflux.com > ~/.ssh/known_hosts | |
- run: chmod 0755 ~/.ssh/; chmod 600 ~/.ssh/$URL; chmod 644 ~/.ssh/known_hosts | |
- name: Setup SSH passphrase | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
echo 'echo $PASS' > ~/.ssh_askpass && chmod +x ~/.ssh_askpass | |
echo "$SSH" | tr -d '\r' | DISPLAY=None SSH_ASKPASS=~/.ssh_askpass ssh-add - >/dev/null | |
- name: Get latest production code and build | |
run: ssh $URL "cd $ROOT; git checkout production; git pull; nvm install; yarn install; yarn build" | |
deploy-de: | |
name: Deploy interflux.de (Frankfurt) | |
runs-on: ubuntu-latest | |
needs: deploy-com | |
env: | |
SSH: ${{secrets.FRANKFURT_SSH}} | |
URL: admin@frankfurt.server.interflux.com | |
ROOT: /var/www/interflux.de | |
# Use the same ssh-agent socket value across all jobs | |
# Useful when a GH action is using SSH behind-the-scenes | |
# Inspired from: | |
# https://stackoverflow.com/questions/64953274/how-to-send-passphrase-for-ssh-add-with-github-actions | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
steps: | |
- uses: actions/checkout@v2 | |
- run: mkdir ~/.ssh | |
- run: 'echo "$SSH" > ~/.ssh/$URL' | |
- run: 'echo "IdentityFile ~/.ssh/$URL" > ~/.ssh/config' | |
- run: ssh-keyscan -H frankfurt.server.interflux.com > ~/.ssh/known_hosts | |
- run: chmod 0755 ~/.ssh/; chmod 600 ~/.ssh/$URL; chmod 644 ~/.ssh/known_hosts | |
- name: Setup SSH passphrase | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
echo 'echo $PASS' > ~/.ssh_askpass && chmod +x ~/.ssh_askpass | |
echo "$SSH" | tr -d '\r' | DISPLAY=None SSH_ASKPASS=~/.ssh_askpass ssh-add - >/dev/null | |
- name: Get latest production code and build | |
run: ssh $URL "cd $ROOT; git checkout production; git pull; nvm install; yarn install; yarn build" | |
deploy-es: | |
name: Deploy interflux.es (Madrid) | |
runs-on: ubuntu-latest | |
needs: deploy-com | |
env: | |
SSH: ${{secrets.MADRID_SSH}} | |
PASS: ${{secrets.MADRID_SSH_PASS}} | |
URL: admin@madrid.server.interflux.com | |
ROOT: /var/www/interflux.es | |
# Use the same ssh-agent socket value across all jobs | |
# Useful when a GH action is using SSH behind-the-scenes | |
# Inspired from: | |
# https://stackoverflow.com/questions/64953274/how-to-send-passphrase-for-ssh-add-with-github-actions | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
steps: | |
- uses: actions/checkout@v2 | |
- run: mkdir ~/.ssh | |
- run: 'echo "$SSH" > ~/.ssh/$URL' | |
- run: 'echo "IdentityFile ~/.ssh/$URL" > ~/.ssh/config' | |
- run: ssh-keyscan -H madrid.server.interflux.com > ~/.ssh/known_hosts | |
- run: chmod 0755 ~/.ssh/; chmod 600 ~/.ssh/$URL; chmod 644 ~/.ssh/known_hosts | |
- name: Setup SSH passphrase | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
echo 'echo $PASS' > ~/.ssh_askpass && chmod +x ~/.ssh_askpass | |
echo "$SSH" | tr -d '\r' | DISPLAY=None SSH_ASKPASS=~/.ssh_askpass ssh-add - >/dev/null | |
- name: Get latest production code and build | |
run: ssh $URL "cd $ROOT; git checkout production; git pull; nvm install; yarn install; yarn build" | |
deploy-fr: | |
name: Deploy interflux.fr (Paris) | |
runs-on: ubuntu-latest | |
needs: deploy-com | |
env: | |
SSH: ${{secrets.PARIS_SSH}} | |
PASS: ${{secrets.PARIS_SSH_PASS}} | |
URL: admin@paris.server.interflux.com | |
ROOT: /var/www/interflux.fr | |
# Use the same ssh-agent socket value across all jobs | |
# Useful when a GH action is using SSH behind-the-scenes | |
# Inspired from: | |
# https://stackoverflow.com/questions/64953274/how-to-send-passphrase-for-ssh-add-with-github-actions | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
steps: | |
- uses: actions/checkout@v2 | |
- run: mkdir ~/.ssh | |
- run: 'echo "$SSH" > ~/.ssh/$URL' | |
- run: 'echo "IdentityFile ~/.ssh/$URL" > ~/.ssh/config' | |
- run: ssh-keyscan -H paris.server.interflux.com > ~/.ssh/known_hosts | |
- run: chmod 0755 ~/.ssh/; chmod 600 ~/.ssh/$URL; chmod 644 ~/.ssh/known_hosts | |
- name: Setup SSH passphrase | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
echo 'echo $PASS' > ~/.ssh_askpass && chmod +x ~/.ssh_askpass | |
echo "$SSH" | tr -d '\r' | DISPLAY=None SSH_ASKPASS=~/.ssh_askpass ssh-add - >/dev/null | |
- name: Get latest production code and build | |
run: ssh $URL "cd $ROOT; git checkout production; git pull; nvm install; yarn install; yarn build" | |
deploy-mx: | |
name: Deploy interflux.mx (Mexico) | |
runs-on: ubuntu-latest | |
needs: deploy-com | |
env: | |
SSH: ${{secrets.MEXICO_SSH}} | |
PASS: ${{secrets.MEXICO_SSH_PASS}} | |
URL: admin@mexico.server.interflux.com | |
ROOT: /var/www/interflux.mx | |
# Use the same ssh-agent socket value across all jobs | |
# Useful when a GH action is using SSH behind-the-scenes | |
# Inspired from: | |
# https://stackoverflow.com/questions/64953274/how-to-send-passphrase-for-ssh-add-with-github-actions | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
steps: | |
- uses: actions/checkout@v2 | |
- run: mkdir ~/.ssh | |
- run: 'echo "$SSH" > ~/.ssh/$URL' | |
- run: 'echo "IdentityFile ~/.ssh/$URL" > ~/.ssh/config' | |
- run: ssh-keyscan -H mexico.server.interflux.com > ~/.ssh/known_hosts | |
- run: chmod 0755 ~/.ssh/; chmod 600 ~/.ssh/$URL; chmod 644 ~/.ssh/known_hosts | |
- name: Setup SSH passphrase | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
echo 'echo $PASS' > ~/.ssh_askpass && chmod +x ~/.ssh_askpass | |
echo "$SSH" | tr -d '\r' | DISPLAY=None SSH_ASKPASS=~/.ssh_askpass ssh-add - >/dev/null | |
- name: Get latest production code and build | |
run: ssh $URL "cd $ROOT; git checkout production; git pull; nvm install; yarn install; yarn build" | |
deploy-cn: | |
name: Deploy interflux.cn.com (Osaka) | |
runs-on: ubuntu-latest | |
needs: deploy-com | |
env: | |
SSH: ${{secrets.OSAKA_SSH}} | |
PASS: ${{secrets.OSAKA_SSH_PASS}} | |
URL: admin@osaka.server.interflux.com | |
ROOT: /var/www/interflux.cn.com | |
# Use the same ssh-agent socket value across all jobs | |
# Useful when a GH action is using SSH behind-the-scenes | |
# Inspired from: | |
# https://stackoverflow.com/questions/64953274/how-to-send-passphrase-for-ssh-add-with-github-actions | |
SSH_AUTH_SOCK: /tmp/ssh_agent.sock | |
steps: | |
- uses: actions/checkout@v2 | |
- run: mkdir ~/.ssh | |
- run: 'echo "$SSH" > ~/.ssh/$URL' | |
- run: 'echo "IdentityFile ~/.ssh/$URL" > ~/.ssh/config' | |
- run: ssh-keyscan -H osaka.server.interflux.com > ~/.ssh/known_hosts | |
- run: chmod 0755 ~/.ssh/; chmod 600 ~/.ssh/$URL; chmod 644 ~/.ssh/known_hosts | |
- name: Setup SSH passphrase | |
run: | | |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null | |
echo 'echo $PASS' > ~/.ssh_askpass && chmod +x ~/.ssh_askpass | |
echo "$SSH" | tr -d '\r' | DISPLAY=None SSH_ASKPASS=~/.ssh_askpass ssh-add - >/dev/null | |
- name: Get latest production code and build | |
run: ssh $URL "cd $ROOT; git checkout production; git pull; nvm install; yarn install; yarn build" | |
# TODO: | |
# deploy-de: | |
# name: Deploy interflux.fr | |
# runs-on: ubuntu-latest | |
# needs: test | |
# env: | |
# DEPLOY_KEY: ${{secrets.DEPLOY_KEY}} | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - run: >- | |
# curl -X POST -d {"project": "interflux.com"} -H "Authorization: token $DEPLOY_KEY" https://frankfurt.server.interflux.comm/deploy | |
# - run: >- | |
# curl -X POST -d {"project": "interflux.de"} -H "Authorization: token $DEPLOY_KEY" https://frankfurt.server.interflux.com/deploy | |
# - run: >- | |
# curl -X POST -d {"project": "interflux.es"} -H "Authorization: token $DEPLOY_KEY" https://madrid.server.interflux.com/deploy | |
# - run: >- | |
# curl -X POST -d {"project": "interflux.fr"} -H "Authorization: token $DEPLOY_KEY" https://paris.server.interflux.com/deploy |