fear: add new features. #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
changes: | |
name: Detect files changes | |
runs-on: ubuntu-latest | |
timeout-minutes: 3 | |
outputs: | |
web: ${{ steps.filter.outputs.web }} | |
api: ${{ steps.filter.outputs.api }} | |
docs: ${{ steps.filter.outputs.docs }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dorny/paths-filter@v3 | |
id: filter | |
with: | |
filters: | | |
web: | |
- './.github/workflows/Build.yml' | |
- './web/**' | |
api: | |
- '!./.github/workflows/Build.yml' | |
- '!./web/**' | |
docs: | |
- './README.md' | |
- './web/README.md' | |
- name: List all changed files | |
run: | |
echo steps.filter.outputs | |
build-web: | |
name: Build Web | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{needs.changes.outputs.web == 'true'}} | |
defaults: | |
run: | |
working-directory: ./web | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Build Next.js App | |
run: | | |
npm run build | |
env: | |
NEXT_PUBLIC_API_KEY: ${{ secrets.WEB_API_KEY }} | |
NEXT_PUBLIC_AUTH_DOMAIN: ${{ vars.WEB_AUTH_DOMAIN }} | |
NEXT_PUBLIC_PROJECT_ID: ${{ vars.WEB_PROJECT_ID }} | |
NEXT_PUBLIC_STORAGE_BUCKET: ${{ vars.WEB_STORAGE_BUCKET }} | |
NEXT_PUBLIC_MESSAGING_SENDER_ID: ${{ vars.WEB_MESSAGING_SENDER_ID }} | |
NEXT_PUBLIC_APP_ID: ${{ secrets.WEB_APP_ID }} | |
NEXT_PUBLIC_MEASUREMENT_ID: ${{ vars.WEB_MEASUREMENT_ID }} | |
NEXT_PUBLIC_APP_API_BASE_URL: ${{ secrets.APP_API_BASE_URL }} | |
NEXT_PUBLIC_APP_API_KEY: ${{ secrets.APP_API_KEY }} | |
build-api: | |
name: Build API | |
runs-on: ubuntu-latest | |
needs: changes | |
if: ${{needs.changes.outputs.api == 'true'}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install pipenv | |
run: | | |
python -m pip install --upgrade pipenv wheel | |
- name: Cache PipEnv | |
id: cache-pipenv | |
uses: actions/cache@v4 | |
with: | |
path: ~/.local/share/virtualenvs | |
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }} | |
- name: Install dependencies | |
if: steps.cache-pipenv.outputs.cache-hit != 'true' | |
run: | | |
pipenv install --deploy --dev | |
- name: Run tests | |
run: | | |
pipenv run python manage.py test | |
env: | |
SECRET_KEY: "NSNLNDNLN" |