π Release V2.0.6 #44
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: [main] | |
workflow_dispatch: | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Node.js Environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm install | |
- name: Build | |
run: npm run build | |
- name: Get Version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@master | |
- name: Generate Zip | |
uses: papeloto/action-zip@v1 | |
with: | |
files: dist/ | |
dest: vidat-v${{ steps.package-version.outputs.current-version}}.zip | |
- name: Auto Release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: latest | |
prerelease: true | |
title: Development Release v${{ steps.package-version.outputs.current-version}} | |
files: | | |
vidat-v${{ steps.package-version.outputs.current-version}}.zip | |
- name: Deploy With SSH (Optional) | |
uses: easingthemes/ssh-deploy@main | |
if: ${{ env.SSH_PRIVATE_KEY != '' && env.REMOTE_HOST != '' && env.REMOTE_USER != '' }} | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
ARGS: -rltgoDzvO | |
SOURCE: dist/ | |
REMOTE_HOST: ${{ secrets.HOST }} | |
REMOTE_USER: ${{ secrets.USER }} | |
TARGET: ${{ secrets.TARGET }} | |
- name: Inject Umami Script (Optional) | |
uses: appleboy/ssh-action@master | |
if: ${{ env.SSH_PRIVATE_KEY != '' && env.REMOTE_HOST != '' && env.REMOTE_USER != '' && env.UMAMI_SCRIPT != '' }} | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} | |
REMOTE_HOST: ${{ secrets.HOST }} | |
REMOTE_USER: ${{ secrets.USER }} | |
UMAMI_SCRIPT: ${{ secrets.UMAMI_SCRIPT }} | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USER }} | |
key: ${{ secrets.PRIVATE_KEY }} | |
script: | | |
cd ${{ secrets.TARGET }} | |
mv index.html index.html.bak | |
sed "/<\/head>/ i ${{ secrets.UMAMI_SCRIPT }}" index.html.bak > index.html |