fix(workflow): frontend build not working properly

This commit is contained in:
itsscb 2024-08-28 20:20:09 +02:00
parent c612aa9bac
commit ed99f87d62

View File

@ -7,10 +7,10 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Cache dependencies - name: cache dependencies
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: | path: |
@ -19,66 +19,61 @@ jobs:
~/.cache/trunk/ ~/.cache/trunk/
target/ target/
node_modules/ node_modules/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} key: ${{ runner.os }}-cargo-${{ hashFiles('./Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-wordl restore-keys: ${{ runner.os }}-cargo-wordl
- name: Install Rust - name: install rust
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
profile: minimal profile: minimal
toolchain: stable toolchain: stable
- name: Add Rust target wasm32-unknown-unknown - name: add rust target wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown run: rustup target add wasm32-unknown-unknown
- name: Install Trunk - name: install trunk
run: cargo install trunk run: cargo install trunk
- name: Install Node.js - name: install node.js
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
- name: Install Tailwind CSS - name: install tailwindcss
run: npm install -g tailwindcss run: npm install -g tailwindcss
- name: Build Frontend - name: build frontend
working-directory: ./frontend/ working-directory: ./frontend/
run: | run: |
trunk build --release trunk build --release
- name: Commit Frontend Release Build - name: upload frontend artifacts
run: |
git config --global user.name "github-actions"
git config --global user.email "dev@itsscb.de"
git add -A
git commit -m "release: frontend"
git push
- name: Upload Frontend Artifacts
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: frontend-artifacts name: frontend-artifacts
path: ./frontend/dist path: ./frontend/dist
- name: run tests
- name: Build and test code
run: | run: |
cargo build --verbose --release
cargo test --verbose cargo test --verbose
deploy: deploy:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build needs: build
steps: steps:
- name: Download Frontend Artifacts - name: checkout
uses: actions/checkout@v4
- name: download frontend artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: frontend-artifacts name: frontend-artifacts
- name: Checkout - name: display structure of downloaded files
uses: actions/checkout@v4 run: ls -R
working-directory: ./frontend/dist
- uses: shuttle-hq/deploy-action@main - uses: shuttle-hq/deploy-action@main
with: with:
deploy-key: ${{ secrets.SHUTTLE_API_KEY }} deploy-key: ${{ secrets.SHUTTLE_API_KEY }}
working-directory: .