Skip to content

Commit

Permalink
ci: move deploy into separate workflow
Browse files Browse the repository at this point in the history
Co-authored-by: steveoh <[email protected]>
  • Loading branch information
stdavis and steveoh committed Aug 14, 2024
1 parent f6a1227 commit 7e397b1
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 59 deletions.
62 changes: 3 additions & 59 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ on:
- dev
- main

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

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

steps:
- name: 🚀 Create Release
Expand All @@ -34,54 +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-please
environment:
name: dev
url: https://atlas.dev.utah.gov
if: github.ref_name == 'dev' && needs.release-please.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 -- --mode dev
env:
VITE_DISCOVER: ${{ secrets.VITE_DISCOVER }}
VITE_WEB_API: ${{ secrets.VITE_WEB_API }}
VITE_PRINT_PROXY: ${{ secrets.VITE_PRINT_PROXY }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}

deploy-prod:
name: Deploy to production
runs-on: ubuntu-latest
needs: release-please
environment:
name: prod
url: https://atlas.utah.gov
if: github.ref_name == 'main' && needs.release-please.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 -- --mode production
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 }}
env:
VITE_DISCOVER: ${{ secrets.VITE_DISCOVER }}
VITE_WEB_API: ${{ secrets.VITE_WEB_API }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Release Events

on:
release:
types: [published]
workflow_dispatch:
inputs:
environment:
description: 'Environment to run tests against'
type: environment
required: true

permissions:
id-token: write
deployments: write

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

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 -- --mode dev
env:
VITE_DISCOVER: ${{ secrets.VITE_DISCOVER }}
VITE_WEB_API: ${{ secrets.VITE_WEB_API }}
VITE_PRINT_PROXY: ${{ secrets.VITE_PRINT_PROXY }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}

deploy-prod:
name: Deploy to production
runs-on: ubuntu-latest
environment:
name: prod
url: https://atlas.utah.gov
if: github.event.release.prerelease == false || inputs.environment == 'prod'

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 -- --mode production
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 }}
env:
VITE_DISCOVER: ${{ secrets.VITE_DISCOVER }}
VITE_WEB_API: ${{ secrets.VITE_WEB_API }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}

notify:
name: Notifications
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 7e397b1

Please sign in to comment.