Skip to content

Commit

Permalink
fix: implement standardized action workflows
Browse files Browse the repository at this point in the history
Closes #68
  • Loading branch information
stdavis committed Apr 5, 2023
1 parent 83e98ac commit 91a6c50
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 133 deletions.
133 changes: 0 additions & 133 deletions .github/workflows/ci.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Pull Request Events

on:
pull_request:

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

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout code
uses: actions/checkout@v3

- name: ⎔ Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: .node-version
cache: npm

- name: 📥 Download dependencies
run: npm ci

- name: 🧪 Run tests
run: npm test

deploy-preview:
name: Firebase preview
runs-on: ubuntu-latest
needs: test
if: ${{ github.event.sender.type == 'User' }}
environment:
name: 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 }}
preview: yes
build-command: npm run build:stage
repo-token: ${{ secrets.GITHUB_TOKEN }}
82 changes: 82 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Push Events

on:
push:
branches:
- dev
- main

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

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

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 }}

steps:
- name: 🚀 Create Release
id: release-please
uses: agrc/release-composite-action@v1
with:
prerelease: ${{ github.ref_name == 'dev' }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
github-app-id: ${{ secrets.UGRC_RELEASE_BOT_APP_ID }}
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://electrofishing-query.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 }}
prebuild-command: npx grunt bump --setversion=${{ needs.release.outputs.released_version }}
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://electrofishing-query.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 }}
prebuild-command: npx grunt bump --setversion=${{ needs.release.outputs.released_version }}
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 }}
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
"autoplay",
"fishsample",
"fullscreen",
"hostingchannels",
"nonwritable",
"nosniff",
"prebuild",
"SAMEORIGIN",
"setversion",
"UDWR",
"udwrgis",
"WILDADMIN",
Expand Down

0 comments on commit 91a6c50

Please sign in to comment.