ci: try to fix preview #8
Workflow file for this run
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: preview | |
on: [pull_request] | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: 'preview-${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: setup node and pnpm | |
uses: dafnik/setup-node-pnpm@v3 | |
with: | |
install: true | |
- name: build | |
run: pnpm build | |
- name: Upload artifact | |
id: deployment | |
uses: actions/upload-artifact@v4 | |
with: | |
path: dist | |
name: preview | |
# Deploy job | |
deploy-preview: | |
name: Deploy preview | |
needs: build | |
permissions: | |
pull-requests: write | |
actions: read | |
# Deploy to the preview environment | |
environment: | |
name: preview-${{ github.event.number }} | |
url: ${{ steps.deploy-preview.outputs.url }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: preview | |
path: dist | |
- name: deploy preview | |
id: deploy-preview | |
uses: dafnik/ssp@v1 | |
with: | |
host: preview.dafnik.me | |
username: ${{ secrets.PREVIEW_SSH_USER }} | |
key: ${{ secrets.PREVIEW_SSH_PRIVATE_KEY }} | |
port: ${{ secrets.PREVIEW_SSH_PORT }} | |
source: dist/* | |
target: /var/www/share/preview | |
strip_components: 1 |