Merge remote-tracking branch 'refs/remotes/origin/preview' into preview #7
This file contains hidden or 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: Deploy SMSWithoutBorders Documentation on Server (preview) | |
| on: | |
| push: | |
| branches: | |
| - preview | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: preview-deploy | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| name: Build and Deploy | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: preview | |
| url: https://preview-7.relaysms.afkanerd.de | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Enable Corepack and activate pnpm | |
| run: | | |
| corepack enable | |
| corepack prepare pnpm --activate | |
| - name: Install dependencies | |
| run: pnpm install --no-lockfile | |
| - name: Build application | |
| run: pnpm build | |
| - name: Clean remote target directory | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USER }} | |
| key: ${{ secrets.SSH_KEY }} | |
| script: | | |
| set -e | |
| find "${{ secrets.BUILD_PATH }}" -mindepth 1 -delete | |
| - name: Copy build artifacts to server | |
| uses: appleboy/scp-action@v1 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USER }} | |
| key: ${{ secrets.SSH_KEY }} | |
| source: "./build/*" | |
| target: ${{ secrets.BUILD_PATH }} | |
| strip_components: 1 | |
| rm: false | |
| - name: Run remote deploy script | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USER }} | |
| key: ${{ secrets.SSH_KEY }} | |
| script: | | |
| set -e | |
| echo "::group::Deploying preview build" | |
| ${{ secrets.BUILD_CMD }} | |
| echo "Deploy command finished successfully." | |
| echo "::endgroup::" |