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 }}"