Skip to content

Commit

Permalink
Add first draft of automatic deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ajuvonen committed Oct 30, 2024
1 parent 0d38456 commit 85a0651
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish to production
on:
workflow_dispatch:

# Allow one concurrent deployment
concurrency:
group: 'production'
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.18
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build:production
- name: Install rclone
run: |
curl https://rclone.org/install.sh | sudo bash
- name: Synchronize with rclone using SSH key
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
trap 'rm -f /tmp/deploy_key' EXIT
echo "Starting synchronization"
if ! rclone sync ./dist/ "sftp:${{ secrets.FTP_USER }}:${{ secrets.FTP_HOST }}:${{ secrets.FTP_DIRECTORY }}" --ssh-key-file /tmp/deploy_key --delete-excluded --progress --dry-run --verbose --log-file=rclone.log; then
echo "Error: rclone sync failed" >&2
exit 1
fi
echo "Synchronization completed successfully"
- name: Upload Log
uses: actions/upload-artifact@v4
with:
name: deploy-log
path: rclone.log
3 changes: 3 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Publish to pages

on:
push:
branches:
- main
workflow_dispatch:

# Allow one concurrent deployment
Expand Down

0 comments on commit 85a0651

Please sign in to comment.