feat: add auth app #42
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: | | |
touch .env.local | |
echo NEXT_PUBLIC_API_KEY=${{ secrets.WEB_API_KEY }} >> .env.local | |
echo NEXT_PUBLIC_AUTH_DOMAIN=${{ vars.WEB_AUTH_DOMAIN }} >> .env.local | |
echo NEXT_PUBLIC_PROJECT_ID=${{ vars.WEB_PROJECT_ID }} >> .env.local | |
echo NEXT_PUBLIC_STORAGE_BUCKET=${{ vars.WEB_STORAGE_BUCKET }} >> .env.local | |
echo NEXT_PUBLIC_MESSAGING_SENDER_ID=${{ vars.WEB_MESSAGING_SENDER_ID }} >> .env.local | |
echo NEXT_PUBLIC_APP_ID=${{ secrets.WEB_APP_ID }} >> .env.local | |
echo NEXT_PUBLIC_MEASUREMENT_ID=${{ vars.WEB_MEASUREMENT_ID }} >> .env.local | |
echo NEXT_PUBLIC_APP_API_BASE_URL=${{ secrets.APP_API_BASE_URL }} >> .env.local | |
echo NEXT_PUBLIC_APP_API_KEY=${{ secrets.APP_API_KEY }} >> .env.local | |
npm run build | |
- name: Deploy | |
uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: ${{ secrets.GITHUB_TOKEN }} | |
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
projectId: ${{ secrets.WEB_PROJECT_ID }} | |
entryPoint: ./web | |
channelId: live | |
env: | |
FIREBASE_CLI_EXPERIMENTS: webframeworks | |
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 coverage run --source='.' manage.py test | |
env: | |
SECRET_KEY: "NSNLNDNLN" | |
- name: Generate coverage report | |
run: | | |
pipenv run coverage report |