From 559cd924e9d77dc59b29bf3fd24ab139754e5f3e Mon Sep 17 00:00:00 2001 From: nobkd <44443899+nobkd@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:59:23 +0100 Subject: [PATCH] add local link and build job --- .github/workflows/links.yaml | 16 +++++------ .github/workflows/nue-build.yaml | 23 +++++++++++++++ .github/workflows/publish.yaml | 48 ++++++++++---------------------- 3 files changed, 45 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/nue-build.yaml diff --git a/.github/workflows/links.yaml b/.github/workflows/links.yaml index 4251c6bb..79e71da7 100644 --- a/.github/workflows/links.yaml +++ b/.github/workflows/links.yaml @@ -37,16 +37,14 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 - - name: Install and build site - run: | - bun install - cd packages/nuekit - bun link - cd ../nuejs.org - nue build -p - nue -pP 8080 & + - name: Nue build + uses: ./.github/workflows/nue-build.yaml + with: + root: packages/nuejs.org + + - name: Run server + run: nue -pr packages/nuejs.org -P 8080 & - name: Find files to check id: files diff --git a/.github/workflows/nue-build.yaml b/.github/workflows/nue-build.yaml new file mode 100644 index 00000000..042523f2 --- /dev/null +++ b/.github/workflows/nue-build.yaml @@ -0,0 +1,23 @@ +name: Local nue build + +on: + workflow_call: + inputs: + root: + default: '.' + type: string + +jobs: + nue-build: + runs-on: ubuntu-latest + steps: + - uses: oven-sh/setup-bun@v2 + + - name: Install and link nue + run: | + bun install + cd packages/nuekit/ + bun link + + - name: Build Nue Project + run: nue build -pr ${{ inputs.root }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 5cd4ca7e..d9e8a9a8 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -31,27 +31,16 @@ jobs: - uses: actions/checkout@v4 - name: Check dir changes - run: | - git diff --name-only HEAD^ HEAD | grep -q "^${{ env.dir }}" - - - uses: oven-sh/setup-bun@v2 - - - name: Install - run: bun install + run: git diff --name-only HEAD^ HEAD | grep -q "^${{ env.dir }}" - name: Setup Pages id: pages uses: actions/configure-pages@v5 - - name: Build - run: | - # link nue - cd packages/nuekit/ - bun link - cd - - - # build - nue build -pr ${{ env.dir }} + - name: Nue build + uses: ./.github/workflows/nue-build.yaml + with: + root: ${{ env.dir }} - name: Upload artifact uses: actions/upload-pages-artifact@v3 @@ -78,35 +67,28 @@ jobs: - uses: actions/checkout@v4 - name: Check dir changes - run: | - git diff --name-only HEAD^ HEAD | grep -q "^${{ env.dir }}" - - - uses: oven-sh/setup-bun@v2 - - - name: Install - run: bun install + run: git diff --name-only HEAD^ HEAD | grep -q "^${{ env.dir }}" - name: Setup Pages id: pages uses: actions/configure-pages@v5 - - name: Build and compress + - name: Create source archive run: | - # link nue - cd packages/nuekit/ - bun link - cd - - - # build and archive source - nue build -pr ${{ env.dir }} - git archive -o ${{ env.dir }}.dist/prod/source.tar.gz HEAD:${{ env.dir }} + # source archive + git archive -o ${{ env.dir }}source.tar.gz HEAD:${{ env.dir }} # small test archive if [[ "${{ matrix.dir }}" = "simple-blog" ]]; then cd ${{env.dir}} - tar --exclude ".dist" --exclude "*/img/**" -cf .dist/prod/test.tar.gz . + tar --exclude ".dist" --exclude "*/img/**" -cf test.tar.gz . fi + - name: Nue build + uses: ./.github/workflows/nue-build.yaml + with: + root: ${{ env.dir }} + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: