Deploy #5
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: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "The version of the website to deploy" | |
type: string | |
required: true | |
jobs: | |
build: | |
name: Build image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install node.js v18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Check guide build | |
run: npm run docs:build | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ github.event.inputs.version }} | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- run: | | |
echo "Updating the website to version ${{ github.event.inputs.version }}!" | |
- name: Login and redeploy | |
# Do not use @master because of https://github.com/appleboy/ssh-action/issues/317 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
script: | | |
cd ${{ vars.SSH_PROJECT_ROOT }} | |
sh deployment/update_and_deploy.sh ${{ github.event.inputs.version }} | |
sh deployment/move_dummyassets.sh |