Release #72
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: Release | |
on: | |
workflow_dispatch: | |
# schedule: | |
# - cron: "0 0 * * 0" # At 00:00 on Sunday (weekly) | |
env: | |
BASE: / | |
USER: study-deploy | |
SERVER: studyathome.technikum-wien.at | |
DEST: /var/www/html/hub-public | |
SSH_OPTS: -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get Code | |
uses: actions/checkout@v3 | |
- name: Install NodeGit Build Dependencies | |
run: sudo apt install libkrb5-dev | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 8.5.1 | |
- name: Install Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: pnpm | |
- name: Install Dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
run: pnpm run build | |
env: | |
NODE_OPTIONS: --openssl-legacy-provider | |
- name: Upload Build Result | |
uses: actions/upload-artifact@v3 | |
with: | |
name: hub | |
path: build | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
env: | |
PASS: ${{ secrets.DEPLOY_USER_KEY }} | |
steps: | |
- name: Download Build Result | |
uses: actions/download-artifact@v3 | |
with: | |
name: hub | |
# - name: Check Prerelease | |
# id: prerelease | |
# run: echo "exists=$(sshpass -p ${PASS} ssh ${SSH_OPTS} ${USER}@${SERVER} "if [ -d ${DEST}/next ]; then echo 'true'; else echo 'false'; fi")" >> $GITHUB_OUTPUT | |
# - name: Download Prerelease | |
# if: ${{ steps.prerelease.outputs.exists == 'true' }} | |
# run: sshpass -p ${PASS} scp ${SSH_OPTS} -r ${USER}@${SERVER}:${DEST}/next next | |
# DANGER: | |
# - name: Delete Content from Server | |
# run: sshpass -p ${PASS} ssh ${SSH_OPTS} ${USER}@${SERVER} "echo rm -rf ${DEST}/*" | |
#- name: Upload Build to StudyATHome Server | |
# run: sshpass -p ${PASS} scp ${SSH_OPTS} -r * ${USER}@${SERVER}:${DEST}/ | |
- name: Upload Files | |
id: upload | |
uses: Creepios/[email protected] | |
with: | |
host: ${{ env.SERVER}} | |
port: 2222 | |
username: ${{ env.USER}} | |
password: ${{ secrets.DEPLOY_USER_KEY }} | |
localPath: './' | |
remotePath: './html/hub-public/' | |
# We don't know when the site will be deployed, we just wait a few seconds | |
# Better solutions can be found | |
delay: | |
runs-on: ubuntu-latest | |
needs: deploy | |
steps: | |
- name: Delay for 120 seconds | |
run: sleep 120s | |
algolia: | |
needs: [deploy, delay] | |
uses: ./.github/workflows/algolia.yml | |
with: | |
delete_index: true | |
secrets: inherit |