Skip to content

Commit

Permalink
work on CI/CD for maps app
Browse files Browse the repository at this point in the history
  • Loading branch information
atvaccaro committed Jul 14, 2023
1 parent c5a8a21 commit b4e5f66
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 2 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/deploy-apps-maps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and publish apps/maps

on:
push:
paths:
- 'apps/maps/**'
pull_request:
paths:
- 'apps/maps/**'
workflow_dispatch:

jobs:
build-apps-maps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v1
- uses: actions/setup-node@v3
- run: |
npm install
npm run build
working-directory: apps/maps
# Production
- name: Deploy apps/maps production to Netlify
if: ${{ github.ref == 'refs/heads/main' }}
run: |
npm install -g netlify-cli
netlify deploy --site=maps-calitp-org --dir=apps/maps/build --prod
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}

# Preview on PRs
- name: Deploy apps/maps preview to Netlify
if: ${{ github.ref != 'refs/heads/main' }}
run: |
npm install -g netlify-cli
netlify deploy --site=maps-calitp-org --dir=apps/maps/build --alias=maps-${GITHUB_REPOSITORY#*/}-${PR_NUMBER}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
PR_NUMBER: ${{ github.event.number }}

- uses: peter-evans/find-comment@v2
if: ${{ github.event_name == 'pull_request' }}
id: fc
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
body-includes: --maps-calitp-org.netlify.app

- uses: peter-evans/create-or-update-comment@v2
if: ${{ github.event_name == 'pull_request' }}
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: "Preview url: https://maps-${{github.event.repository.name}}-${{ github.event.number }}--maps-calitp-org.netlify.app"
edit-mode: replace
4 changes: 2 additions & 2 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
if: ${{ github.ref != 'refs/heads/main' }}
run: |
npm install -g netlify-cli
netlify deploy --dir=docs/_build/html --alias=${GITHUB_REPOSITORY#*/}-${PR_NUMBER}
netlify deploy --dir=docs/_build/html --alias=docs-${GITHUB_REPOSITORY#*/}-${PR_NUMBER}
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
Expand All @@ -66,5 +66,5 @@ jobs:
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: "Preview url: https://${{github.event.repository.name}}-${{ github.event.number }}--cal-itp-previews.netlify.app"
body: "Preview url: https://docs-${{github.event.repository.name}}-${{ github.event.number }}--cal-itp-previews.netlify.app"
edit-mode: replace
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,6 @@ dmypy.json

#.DS_Store files that Macs create
.DS_Store

# Local Netlify folder
.netlify

0 comments on commit b4e5f66

Please sign in to comment.