Skip to content

Commit

Permalink
Conditionally run gh actions to save resources
Browse files Browse the repository at this point in the history
- Tests and Formatting ignore `t/` and `fastn.com/` subfolders. It only
  runs when `.{rs,ftd,p1,html,js,css}` files are changed.
- Optimize Images only runs on changes in the `fastn.com` subfolder
- Fix env setting for `deploy-fastn-com.yml`
  • Loading branch information
siddhantk232 authored and amitu committed Nov 13, 2024
1 parent 61b5021 commit ce46ff8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy-fastn-com.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ on:
- '.github/workflows/deploy-fastn-com.yml'

jobs:
env:
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions
FIFTHTRY_SITE_WRITE_TOKEN: ${{ secrets.FIFTHTRY_SITE_WRITE_TOKEN }}
build:
runs-on: ubuntu-latest
env:
# https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions
FIFTHTRY_SITE_WRITE_TOKEN: ${{ secrets.FIFTHTRY_SITE_WRITE_TOKEN }}
steps:
- uses: actions/checkout@v4
- run: source <(curl -fsSL https://fastn.com/install.sh)
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/optimize-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- main
paths:
- '**.jpg'
- '**.jpeg'
- '**.png'
- '**.webp'
- 'fastn.com/**.jpg'
- 'fastn.com/**.jpeg'
- 'fastn.com/**.png'
- 'fastn.com/**.webp'
jobs:
build:
name: calibreapp/image-actions
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/tests-and-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,36 @@ on:
workflow_dispatch:
push:
branches: [ main ]
paths:
# Order matters!
# See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
- '**.rs'
- '**.ftd' # ftd/html/js/css are fbt-tests items mostly
- '**.p1'
- '**.html'
- '**.js'
- '**.css'
- '!t/' # We use this for playground
- '!fastn.com/'
- '!v0.5/' # TODO: remove this when we're ready to release v0.5
- '!.github/'
- '.github/workflows/tests-and-formatting.yml'
pull_request:
branches: [ main ]
paths:
# Order matters!
# See https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore
- '**.rs'
- '**.ftd' # ftd/html/js/css are fbt-tests items mostly
- '**.p1'
- '**.html'
- '**.js'
- '**.css'
- '!t/' # We use this for playground
- '!fastn.com/'
- '!v0.5/' # TODO: remove this when we're ready to release v0.5
- '!.github/'
- '.github/workflows/tests-and-formatting.yml'
jobs:
tests-and-formatting:
name: Rust/JS Checks/Formatting
Expand Down

0 comments on commit ce46ff8

Please sign in to comment.