practice link to codeskiller #58
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: deploy | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- uses: actions/cache@v1 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Read .nvmrc | |
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" | |
id: nvm | |
- name: Use Node.js (.nvmrc) | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "${{ steps.nvm.outputs.NVMRC }}" | |
- name: Installing Dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build --env production | |
- name: Create temp Directory | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST_PRODUCTION }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.PRIVATE_KEY }} | |
script: mkdir -p ~/temp && rm -rf ~/temp/* | |
- name: Upload Build | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST_PRODUCTION }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.PRIVATE_KEY }} | |
source: "dist" | |
target: "temp" | |
- name: Replace New Build | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST_PRODUCTION }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.PRIVATE_KEY }} | |
script: rm -rf ~/frontends/hiringblocks/* && cp -rf ~/temp/dist/* ~/frontends/hiringblocks && rm -rf ~/temp |