From 747c01edf669f55a6241c1b484e3d2e41e083c8f Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 10 Dec 2024 13:33:40 -0500 Subject: [PATCH 1/8] Test deploy on pull request --- .github/workflows/firebase-hosting-merge.yml | 10 ++++----- .../firebase-hosting-pull-request.yml | 22 +++++++++++++++++-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index c14a7dac..3cd5511d 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -2,15 +2,15 @@ # https://github.com/firebase/firebase-tools name: Deploy to Firebase Hosting on merge -'on': - push: - branches: - - master +on: + push: + branches: + - master jobs: build_and_deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && yarn build - uses: FirebaseExtended/action-hosting-deploy@v0 with: diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index bd01a2a7..277a5d7d 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -2,14 +2,32 @@ # https://github.com/firebase/firebase-tools name: Deploy to Firebase Hosting on PR -'on': pull_request + +on: + pull_request: + branches: + - '*/*' + pull_request_target: + types: + - opened + branches: + - '*/*' + +permissions: + pull-requests: write + contents: read + jobs: build_and_preview: if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' runs-on: ubuntu-latest + env: + OKTA_APP_ISSUER: ${{secrets.OKTA_APP_ISSUER}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && yarn build + - run: | + echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local - uses: FirebaseExtended/action-hosting-deploy@v0 with: entryPoint: './login-workflow' From 48952679c9a16c3ca7975b2d25d5adc3a0d59a87 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 10 Dec 2024 13:48:38 -0500 Subject: [PATCH 2/8] add some notes --- .github/workflows/firebase-hosting-pull-request.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 277a5d7d..a5f04933 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -1,5 +1,8 @@ # This file was auto-generated by the Firebase CLI # https://github.com/firebase/firebase-tools +# Run - yarn firebase login +# Run - yarn firebase init hosting (new) +# Run - yarn firebase init hosting:github (only if hosting has previously been setup) name: Deploy to Firebase Hosting on PR From 3dd0112fd0495c4a6da96c286fa39f260cf3fb71 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 10 Dec 2024 13:58:59 -0500 Subject: [PATCH 3/8] update on PR --- .../firebase-hosting-pull-request.yml | 11 ++------- login-workflow/firebase.json | 24 +++++++++++-------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index a5f04933..0faecdf2 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -6,19 +6,12 @@ name: Deploy to Firebase Hosting on PR -on: - pull_request: - branches: - - '*/*' - pull_request_target: - types: - - opened - branches: - - '*/*' +on: pull_request permissions: pull-requests: write contents: read + checks: write jobs: build_and_preview: diff --git a/login-workflow/firebase.json b/login-workflow/firebase.json index 4618be3b..78a26c73 100644 --- a/login-workflow/firebase.json +++ b/login-workflow/firebase.json @@ -1,12 +1,16 @@ { - "hosting": { - "public": "example/build", - "ignore": ["firebase.json", "**/.*", "**/node_modules/**"], - "rewrites": [ - { - "source": "**", - "destination": "/index.html" - } - ] - } + "hosting": { + "public": "example/build", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ], + "rewrites": [ + { + "source": "**", + "destination": "/index.html" + } + ] + } } From af0721c09658372c9c695fc22fb3837c21a60ab0 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 10 Dec 2024 14:16:33 -0500 Subject: [PATCH 4/8] test directory change --- .github/workflows/firebase-hosting-pull-request.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 0faecdf2..be81fcdb 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -23,6 +23,7 @@ jobs: - uses: actions/checkout@v4 - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && yarn build - run: | + cd login-workflow/example echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local - uses: FirebaseExtended/action-hosting-deploy@v0 with: From 83fa4dc88da4b20b20da61348e69f29597d25e11 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 10 Dec 2024 14:25:08 -0500 Subject: [PATCH 5/8] create file --- .github/workflows/firebase-hosting-pull-request.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index be81fcdb..b037e0cb 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -24,6 +24,7 @@ jobs: - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && yarn build - run: | cd login-workflow/example + touch .env.local echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local - uses: FirebaseExtended/action-hosting-deploy@v0 with: From 8a1d66af321317167e2e0301d208fed798257391 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 10 Dec 2024 14:33:05 -0500 Subject: [PATCH 6/8] run in script --- .github/workflows/firebase-hosting-pull-request.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index b037e0cb..c8fcd9a0 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -21,11 +21,11 @@ jobs: OKTA_APP_ISSUER: ${{secrets.OKTA_APP_ISSUER}} steps: - uses: actions/checkout@v4 - - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && yarn build - - run: | - cd login-workflow/example - touch .env.local - echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local + - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local && yarn build + # - run: | + # cd login-workflow/example + # touch .env.local + # echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local - uses: FirebaseExtended/action-hosting-deploy@v0 with: entryPoint: './login-workflow' From dd55028048da5c0b48ed04e2037f282948a86fd5 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 10 Dec 2024 15:30:34 -0500 Subject: [PATCH 7/8] test pr deploy --- .github/workflows/firebase-hosting-pull-request.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index c8fcd9a0..91e1025a 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -24,7 +24,6 @@ jobs: - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local && yarn build # - run: | # cd login-workflow/example - # touch .env.local # echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local - uses: FirebaseExtended/action-hosting-deploy@v0 with: From fddba97beb57ed33584cb4453d2edb3868796091 Mon Sep 17 00:00:00 2001 From: jeffgreiner-eaton Date: Tue, 10 Dec 2024 15:50:59 -0500 Subject: [PATCH 8/8] Update on merge firebase deploy --- .github/workflows/firebase-hosting-merge.yml | 10 +++++++++- .github/workflows/firebase-hosting-pull-request.yml | 6 ------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/firebase-hosting-merge.yml b/.github/workflows/firebase-hosting-merge.yml index 3cd5511d..73b8b7b8 100644 --- a/.github/workflows/firebase-hosting-merge.yml +++ b/.github/workflows/firebase-hosting-merge.yml @@ -6,12 +6,20 @@ on: push: branches: - master + +permissions: + pull-requests: write + contents: read + checks: write + jobs: build_and_deploy: runs-on: ubuntu-latest + env: + OKTA_APP_ISSUER: ${{secrets.OKTA_APP_ISSUER}} steps: - uses: actions/checkout@v4 - - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && yarn build + - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local && yarn build - uses: FirebaseExtended/action-hosting-deploy@v0 with: entryPoint: './login-workflow' diff --git a/.github/workflows/firebase-hosting-pull-request.yml b/.github/workflows/firebase-hosting-pull-request.yml index 91e1025a..fffd1ff6 100644 --- a/.github/workflows/firebase-hosting-pull-request.yml +++ b/.github/workflows/firebase-hosting-pull-request.yml @@ -1,8 +1,5 @@ # This file was auto-generated by the Firebase CLI # https://github.com/firebase/firebase-tools -# Run - yarn firebase login -# Run - yarn firebase init hosting (new) -# Run - yarn firebase init hosting:github (only if hosting has previously been setup) name: Deploy to Firebase Hosting on PR @@ -22,9 +19,6 @@ jobs: steps: - uses: actions/checkout@v4 - run: cd login-workflow && yarn install:dependencies && yarn link:workflow && cd example && yarn && echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local && yarn build - # - run: | - # cd login-workflow/example - # echo "${{ secrets.OKTA_APP_ISSUER }}" > .env.local - uses: FirebaseExtended/action-hosting-deploy@v0 with: entryPoint: './login-workflow'