From 9c45e52fd2a0701a741c917992d08eef5b4c2858 Mon Sep 17 00:00:00 2001 From: nobkd <44443899+nobkd@users.noreply.github.com> Date: Sat, 30 Nov 2024 01:46:25 +0100 Subject: [PATCH] break sites in two site / examples --- .../{sites.yaml => push-examples.yaml} | 40 ++---------------- .github/workflows/push-site.yaml | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+), 36 deletions(-) rename .github/workflows/{sites.yaml => push-examples.yaml} (55%) create mode 100644 .github/workflows/push-site.yaml diff --git a/.github/workflows/sites.yaml b/.github/workflows/push-examples.yaml similarity index 55% rename from .github/workflows/sites.yaml rename to .github/workflows/push-examples.yaml index ad1e5d28..91b524cf 100644 --- a/.github/workflows/sites.yaml +++ b/.github/workflows/push-examples.yaml @@ -1,11 +1,10 @@ -name: Build and push sites to web server +name: Push examples to web server on: push: branches: - master paths: - - packages/nuejs.org/** - packages/examples/** concurrency: @@ -13,43 +12,14 @@ concurrency: cancel-in-progress: false jobs: - site: - if: ${{ github.repository_owner == 'nuejs' }} - env: - dir: 'packages/nuejs.org/' - host: 'nuejs.org' - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Check dir changes - run: git diff --name-only HEAD^ HEAD | grep -q "^${{ env.dir }}" - - - name: Nue build - uses: ./.github/workflows/repo/build-page - with: - root: ${{ env.dir }} - - - name: Prepare SSH - uses: kielabokkie/ssh-key-and-known-hosts-action@v1 - with: - ssh-private-key: ${{ secrets.SSH_PRIVATE }} - ssh-host: ${{ secrets.SSH_HOST }} - - - name: Push files to web server - run: scp ${{ env.dir }}.dist/prod/site.tar.gz ${{ env.host }}@${{ secrets.SSH_HOST }} - ssh ${{ env.host }}@${{ secrets.SSH_HOST }} "tar -xf site.tar.gz" - examples: if: ${{ github.repository_owner == 'nuejs' }} + strategy: matrix: dir: - simple-blog + env: dir: 'packages/examples/${{ matrix.dir }}/' host: '${{ matrix.dir }}.nuejs.org' @@ -58,11 +28,9 @@ jobs: steps: - uses: actions/checkout@v4 - with: - fetch-depth: 2 - name: Check dir changes - run: git diff --name-only HEAD^ HEAD | grep -q "^${{ env.dir }}" + run: git diff --name-only HEAD | grep -q "^${{ env.dir }}" - name: Create test archive run: tar --exclude "*/img" -C ${{ env.dir }} -cf ${{ env.dir }}test.tar.gz . diff --git a/.github/workflows/push-site.yaml b/.github/workflows/push-site.yaml new file mode 100644 index 00000000..4bfe0b3d --- /dev/null +++ b/.github/workflows/push-site.yaml @@ -0,0 +1,41 @@ +name: Push site to web server + +on: + push: + branches: + - master + paths: + - packages/nuejs.org/** + +concurrency: + group: 'pages' + cancel-in-progress: false + +jobs: + site: + if: ${{ github.repository_owner == 'nuejs' }} + + env: + dir: 'packages/nuejs.org/' + host: 'nuejs.org' + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Nue build + uses: ./.github/workflows/repo/build-page + with: + root: ${{ env.dir }} + + - name: Prepare SSH + uses: kielabokkie/ssh-key-and-known-hosts-action@v1 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE }} + ssh-host: ${{ secrets.SSH_HOST }} + + - name: Push files to web server + run: | + scp ${{ env.dir }}.dist/prod/site.tar.gz ${{ env.host }}@${{ secrets.SSH_HOST }} + ssh ${{ env.host }}@${{ secrets.SSH_HOST }} "tar -xf site.tar.gz"