Skip to content

fix: add condition to deploy job #23

fix: add condition to deploy job

fix: add condition to deploy job #23

Workflow file for this run

name: Deploy GitHub Pages
on:
push:
branches: [master, dev]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build-dev:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: |
cargo install trunk || true \
&& rustup target add wasm32-unknown-unknown
- name: Build the Rust WASM app and all of its assets
env:
CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
run: |
cd frontend
trunk build --release --public-url "/${{ github.event.repository.name }}/dev/"
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './dist'
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore cache
uses: actions/cache@v3
with:
path: |
~/.cargo/bin
~/.cargo/git
~/.cargo/registry
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: |
cargo install trunk || true \
&& rustup target add wasm32-unknown-unknown
- name: Build the Rust WASM app and all of its assets
env:
CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
run: |
cd frontend
trunk build --release --public-url "/${{ github.event.repository.name }}/"
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './dist'
deploy:
if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
needs: [build, build-dev]
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2