Skip to content

Commit

Permalink
ci: move deploy jobs to separate release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Oct 3, 2024
1 parent 2bdce93 commit 79cf83e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 71 deletions.
11 changes: 1 addition & 10 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@ name: Pull Request Events

on:
pull_request:
paths:
- '.env*'
- '.firebaserc'
- '.github/workflows/nodejs.yml'
- 'firebase.json'
- 'package-lock.json'
- 'package.json'
- 'public/**'
- 'src/**'

permissions:
contents: write
Expand Down Expand Up @@ -49,7 +40,7 @@ jobs:
name: Firebase preview
runs-on: ubuntu-latest
needs: test
if: ${{ github.event.sender.type == 'User' }}
if: ${{ github.event.sender.type == 'User' && github.head_ref != 'dev' }}
environment:
name: dev

Expand Down
64 changes: 3 additions & 61 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,6 @@ on:
branches:
- dev
- main
paths:
- '.env*'
- '.firebaserc'
- '.github/workflows/nodejs.yml'
- 'firebase.json'
- 'package-lock.json'
- 'package.json'
- 'public/**'
- 'src/**'

permissions:
contents: write
id-token: write
deployments: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -29,9 +14,9 @@ jobs:
release:
name: Create release
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}
released_version: ${{ steps.release-please.outputs.released_version }}
permissions:
contents: write
pull-requests: write

steps:
- name: 🚀 Create Release
Expand All @@ -44,46 +29,3 @@ jobs:
github-app-key: ${{ secrets.UGRC_RELEASE_BOT_APP_KEY }}
github-app-name: ${{ secrets.UGRC_RELEASE_BOT_NAME }}
github-app-email: ${{ secrets.UGRC_RELEASE_BOT_EMAIL }}

deploy-dev:
name: Deploy to staging
runs-on: ubuntu-latest
needs: release
environment:
name: dev
url: https://vista-map.dev.utah.gov
if: github.ref_name == 'dev' && needs.release.outputs.release_created

steps:
- name: 🚀 Deploy
uses: agrc/firebase-website-deploy-composite-action@v1
with:
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
build-command: npm run build:stage
repo-token: ${{ secrets.GITHUB_TOKEN }}

deploy-prod:
name: Deploy to production
runs-on: ubuntu-latest
needs: release
environment:
name: prod
url: https://vista-map.ugrc.utah.gov
if: github.ref_name == 'main' && needs.release.outputs.release_created

steps:
- name: 🚀 Deploy
uses: agrc/firebase-website-deploy-composite-action@v1
with:
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
build-command: npm run build:prod
service-now-instance: ${{ secrets.SN_INSTANCE }}
service-now-table: ${{ secrets.SN_TABLE }}
service-now-system-id: ${{ secrets.SN_SYS_ID }}
service-now-username: ${{ secrets.SN_USERNAME }}
service-now-password: ${{ secrets.SN_PASSWORD }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release Events

on:
release:
types: [published]

permissions:
id-token: write
deployments: write

jobs:
deploy-dev:
name: Deploy to staging
runs-on: ubuntu-latest
if: github.event.release.prerelease == true
environment:
name: dev
url: https://vista-map.dev.utah.gov

steps:
- name: 🚀 Deploy
uses: agrc/firebase-website-deploy-composite-action@v1
with:
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
build-command: npm run build:stage
repo-token: ${{ secrets.GITHUB_TOKEN }}

deploy-prod:
name: Deploy to production
runs-on: ubuntu-latest
if: github.event.release.prerelease == false
environment:
name: prod
url: https://vista-map.ugrc.utah.gov

steps:
- name: 🚀 Deploy
uses: agrc/firebase-website-deploy-composite-action@v1
with:
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
build-command: npm run build:prod
service-now-instance: ${{ secrets.SN_INSTANCE }}
service-now-table: ${{ secrets.SN_TABLE }}
service-now-system-id: ${{ secrets.SN_SYS_ID }}
service-now-username: ${{ secrets.SN_USERNAME }}
service-now-password: ${{ secrets.SN_PASSWORD }}
repo-token: ${{ secrets.GITHUB_TOKEN }}

notify:
name: Notifications
needs: deploy-prod
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write

steps:
- name: Release Notifier
uses: agrc/release-issue-notifications-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 79cf83e

Please sign in to comment.