Skip to content

Commit

Permalink
break sites in two site / examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Nov 30, 2024
1 parent f96a6f4 commit e33d83c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,55 +1,25 @@
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:
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
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'
Expand All @@ -62,6 +32,7 @@ jobs:
fetch-depth: 2

- name: Check dir changes
id: changes
run: git diff --name-only HEAD^ HEAD | grep -q "^${{ env.dir }}"

- name: Create test archive
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/push-site.yaml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit e33d83c

Please sign in to comment.