Skip to content

Commit

Permalink
ci: refactor release
Browse files Browse the repository at this point in the history
  • Loading branch information
steveoh committed Oct 3, 2024
1 parent 49594c9 commit 32d7294
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
name: dev

steps:
- name: 🚀 Deploy
- name: 🚀 Deploy preview
uses: agrc/firebase-website-deploy-composite-action@v1
with:
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
Expand Down
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://parcels.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:
repo-token: ${{ secrets.GITHUB_TOKEN }}
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
build-command: npm run build
env:
VITE_DISCOVER_KEY: ${{ secrets.DISCOVER_QUAD_WORD }}
VITE_API_KEY: ${{ secrets.WEB_API_KEY }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}

deploy-prod:
name: Deploy to production
runs-on: ubuntu-latest
needs: release-please
environment:
name: prod
url: https://parcels.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:
repo-token: ${{ secrets.GITHUB_TOKEN }}
identity-provider: ${{ secrets.IDENTITY_PROVIDER }}
service-account-email: ${{ secrets.SERVICE_ACCOUNT_EMAIL }}
project-id: ${{ secrets.PROJECT_ID }}
build-command: npm run build
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 }}
env:
VITE_DISCOVER_KEY: ${{ secrets.DISCOVER_QUAD_WORD }}
VITE_API_KEY: ${{ secrets.WEB_API_KEY }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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://parcels.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
env:
VITE_DISCOVER_KEY: ${{ secrets.DISCOVER_QUAD_WORD }}
VITE_API_KEY: ${{ secrets.WEB_API_KEY }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}

deploy-prod:
name: Deploy to production
runs-on: ubuntu-latest
if: github.event.release.prerelease == false
environment:
name: prod
url: https://parcels.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 }}
env:
VITE_DISCOVER_KEY: ${{ secrets.DISCOVER_QUAD_WORD }}
VITE_API_KEY: ${{ secrets.WEB_API_KEY }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}

release-notifications:
name: Release notifications
needs: deploy-prod
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write

steps:
- name: 💬 Comment on issues in release
uses: agrc/release-issue-notifications-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 32d7294

Please sign in to comment.