Skip to content

Commit

Permalink
ci(.github): add build.yml, use in deploy.yml
Browse files Browse the repository at this point in the history
Signed-off-by: Vaughn Dice <vaughn.dice@fermyon.com>
  • Loading branch information
vdice committed Mar 6, 2024
1 parent e011b37 commit b734066
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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/
13 changes: 11 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
# TODO: rm after testing
- feat/spin-based-deploy
# - main
- main

workflow_dispatch:

Expand All @@ -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
Expand All @@ -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 }}"

0 comments on commit b734066

Please sign in to comment.