47 lines
1.8 KiB
YAML
47 lines
1.8 KiB
YAML
name: Deploy
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
artifact_name:
|
|
required: true
|
|
type: string
|
|
environment:
|
|
required: true
|
|
type: string
|
|
deploy_path:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Download build artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: ${{ inputs.artifact_name }}
|
|
path: ${{ inputs.artifact_name }}
|
|
|
|
# Uploadt de inhoud van dist/ via SCP (over SSH) naar de webroot van de
|
|
# test-omgeving (een Raspberry Pi achter een andere Raspberry Pi met
|
|
# nginx reverse proxy - zie operations/deployment/nginx/ voor de
|
|
# bijbehorende nginx-voorbeeldconfiguratie). Inloggegevens komen uit
|
|
# Gitea Actions Secrets (wachtwoord-login voor nu; zie
|
|
# deployment-instructions.md voor hoe je later naar een SSH-key omzet).
|
|
#
|
|
# Let op: dit gebeurt via een gewone shell-stap in plaats van de
|
|
# appleboy/scp-action Docker-container-action. Die laatste faalt op
|
|
# deze runner met "failed to attach to container: unable to upgrade
|
|
# to tcp, received 409" - een bekende beperking van Podman's
|
|
# Docker-compatibele API, die het attach/log-streaming-mechanisme
|
|
# voor containeracties niet volledig ondersteunt. Een scp-commando
|
|
# in een normale run-stap heeft die geneste container niet nodig.
|
|
- name: Upload dist to ${{ inputs.environment }} web server via SCP
|
|
run: |
|
|
sudo apt-get update && sudo apt-get install -y sshpass
|
|
sshpass -p "${{ secrets.PI_MAIN_PASSWORD }}" scp \
|
|
-P ${{ secrets.PI_MAIN_PORT }} \
|
|
-o StrictHostKeyChecking=no \
|
|
-r ${{ inputs.artifact_name }}/* \
|
|
${{ secrets.PI_MAIN_USERNAME }}@${{ secrets.PI_MAIN_HOST }}:${{ inputs.deploy_path }}
|