From b73406674046e1993514456a6b0e3a512d7edc84 Mon Sep 17 00:00:00 2001 From: Vaughn Dice Date: Tue, 5 Mar 2024 18:10:32 -0700 Subject: [PATCH] ci(.github): add build.yml, use in deploy.yml Signed-off-by: Vaughn Dice --- .github/workflows/build.yml | 34 ++++++++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 13 +++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..97bd3039 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: Build + +on: + pull_request: + branches: [main] + workflow_call: + +jobs: + build: + runs-on: "ubuntu-latest" + env: + HUGO_VERSION: 0.123.0 + steps: + - uses: actions/checkout@v4 + + - name: Install Hugo CLI + run: | + wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \ + && sudo dpkg -i ${{ runner.temp }}/hugo.deb + + - name: Install Node.js dependencies + run: npm install + + - name: Build + run: npm run build + + - name: Archive app artifacts + uses: actions/upload-artifact@v4 + with: + name: app + path: | + spin.toml + modules/ + public/ \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e3d792de..9ebe9561 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,7 +5,7 @@ on: branches: # TODO: rm after testing - feat/spin-based-deploy - # - main + - main workflow_dispatch: @@ -16,10 +16,18 @@ concurrency: cancel-in-progress: false jobs: + build: + uses: ./.github/workflows/build.yml + deploy: runs-on: ubuntu-latest + needs: build steps: - - uses: actions/checkout@v4 + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: app + path: "${{ github.workspace }}" - name: Setup `spin` uses: fermyon/actions/spin/setup@v1 @@ -29,4 +37,5 @@ jobs: - name: Deploy to Fermyon Cloud uses: fermyon/actions/spin/deploy@v1 with: + run_build: false fermyon_token: "${{ secrets.FERMYON_CLOUD_TOKEN }}"