Skip to content

Commit

Permalink
fix: standardize actions
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Oct 6, 2022
1 parent fa0b6a4 commit aa6ce2b
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 200 deletions.
200 changes: 0 additions & 200 deletions .github/workflows/nodejs.yml

This file was deleted.

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

on: pull_request

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

jobs:
test-unit:
name: Unit tests
runs-on: ubuntu-latest

steps:
- name: ⬇️ Set up code
uses: actions/checkout@v3

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

- name: 📥 Download dependencies
run: npm ci

- name: 🧵 Lint
run: npm run lint

- name: 🧪 Run tests
run: npm run test:ci
94 changes: 94 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
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.outputs.release_created }}

steps:
- name: 🚀 Create Release
id: release
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
if: github.ref_name == 'dev' && needs.release.outputs.release_created

steps:
- name: 🚀 Deploy
uses: agrc/cloud-run-docker-deploy-composite-action@dev
with:
identity-provider: secrets.IDENTITY_PROVIDER
service-account-email: secrets.SERVICE_ACCOUNT_EMAIL
project-id: secrets.PROJECT_ID
service: printproxy
flags: |
--service-account=cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com
--allow-unauthenticated
env-vars: 'OPEN_QUAD_WORD=${{ secrets.OPEN_QUAD_WORD }}'
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

deploy-prod:
name: Deploy to production
runs-on: ubuntu-latest
needs: release
environment:
name: prod
if: github.ref_name == 'main' && needs.release.outputs.release_created

steps:
- name: 🚀 Deploy
uses: agrc/cloud-run-docker-deploy-composite-action@dev
with:
identity-provider: secrets.IDENTITY_PROVIDER
service-account-email: secrets.SERVICE_ACCOUNT_EMAIL
project-id: secrets.PROJECT_ID
service: printproxy
flags: |
--service-account=cloud-run-sa@${{ secrets.PROJECT_ID }}.iam.gserviceaccount.com
--allow-unauthenticated
--concurrency=80
--cpu=1
--max-instances=10
--memory=256Mi
--port=8080
--timeout=300s
env-vars: 'OPEN_QUAD_WORD=${{ secrets.OPEN_QUAD_WORD }}'
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

0 comments on commit aa6ce2b

Please sign in to comment.