Last active
January 24, 2023 22:00
-
-
Save DennisAlund/1c0a01496d161191733531652dd8b1fc to your computer and use it in GitHub Desktop.
Revisions
-
DennisAlund revised this gist
Jan 24, 2023 . 1 changed file with 2 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,6 @@ on: - main env: IS_PR_DEV: ${{github.event_name == 'pull_request' && github.base_ref == 'development'}} IS_PUSH_DEV: ${{github.event_name == 'push' && github.ref == 'refs/heads/development'}} @@ -67,7 +66,7 @@ jobs: echo "GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/service_account.json" >> $GITHUB_ENV echo ${{ env.SA_FIREBASE }} | base64 -d - > service_account.json - run: firebase use ${{ env.PROJECT_ALIAS }} - run: yarn --cwd web-app build @@ -80,7 +79,6 @@ jobs: hosting:channel:deploy $(echo ${{ github.head_ref }} | grep -o '[^/]*$') --expires 5d - name: Deploy to Firebase if: github.event_name == 'push' @@ -89,5 +87,4 @@ jobs: --only hosting -m "Github action run $GITHUB_RUN_ID" --non-interactive --force -
DennisAlund revised this gist
Jan 24, 2023 . 1 changed file with 12 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -44,24 +44,29 @@ jobs: - name: Set development environment variables if: env.IS_PR_DEV == 'true' || env.IS_PUSH_DEV == 'true' run: | echo "PROJECT_ALIAS=${{secrets.DEVELOPMENT_PROJECT_ALIAS}}" >> $GITHUB_ENV echo "SA_FIREBASE=${{secrets.DEVELOPMENT_SA}}" >> $GITHUB_ENV - name: Set staging environment variables if: env.IS_PUSH_STAGING == 'true' run: | echo "PROJECT_ALIAS=${{secrets.STAGING_PROJECT_ALIAS}}" >> $GITHUB_ENV echo "SA_FIREBASE=${{secrets.STAGING_SA}}" >> $GITHUB_ENV - name: Set production environment variables if: env.IS_PUSH_PROD == 'true' run: | echo "PROJECT_ALIAS=${{secrets.PRODUCTION_PROJECT_ALIAS}}" >> $GITHUB_ENV echo "SA_FIREBASE=${{secrets.PRODUCTION_SA}}" >> $GITHUB_ENV # The variable `SA_FIREBASE` must be a base64 encoded string # of the service account JSON to avoid problems with quote escaping and # conversion of '\n' characters generating invalid JSON - name: Set service account for Firebase CLI run: | echo "GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/service_account.json" >> $GITHUB_ENV echo ${{ env.SA_FIREBASE }} | base64 -d - > service_account.json - run: firebase use ${{ env.PROJECT_ALIAS }} --token ${{ env.FIREBASE_TOKEN }} - run: yarn --cwd web-app build @@ -81,7 +86,7 @@ jobs: if: github.event_name == 'push' run: >- firebase deploy --only hosting -m "Github action run $GITHUB_RUN_ID" --non-interactive --force -
DennisAlund revised this gist
Jan 24, 2023 . 1 changed file with 10 additions and 18 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,29 +25,21 @@ env: jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 16 cache: 'yarn' cache-dependency-path: | web-app/yarn.lock - name: Install YARN packages run: yarn --cwd web-app install - name: Linting files run: yarn --cwd web-app lint --no-fix - name: Set development environment variables if: env.IS_PR_DEV == 'true' || env.IS_PUSH_DEV == 'true' @@ -72,7 +64,7 @@ jobs: - run: firebase use ${{ env.PROJECT_ALIAS }} --token ${{ env.FIREBASE_TOKEN }} - run: yarn --cwd web-app build - name: Deploy preview channel to Firebase if: github.event_name == 'pull_request' -
DennisAlund created this gist
Apr 5, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,96 @@ name: Hosting on: pull_request: branches: - development - staging - main push: branches: - development - staging - main env: FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} IS_PR_DEV: ${{github.event_name == 'pull_request' && github.base_ref == 'development'}} IS_PUSH_DEV: ${{github.event_name == 'push' && github.ref == 'refs/heads/development'}} IS_PR_STAGING: ${{github.event_name == 'pull_request' && github.base_ref == 'staging'}} IS_PUSH_STAGING: ${{github.event_name == 'push' && github.ref == 'refs/heads/staging'}} IS_PR_PROD: ${{github.event_name == 'pull_request' && github.base_ref == 'main'}} IS_PUSH_PROD: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}} jobs: deploy: runs-on: ubuntu-latest container: image: evenbit/firebase:node14 steps: - uses: actions/checkout@v2 - name: Get YARN cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - name: Initiate YARN cache uses: actions/cache@v1 id: yarn-cache with: path: ${{ steps.yarn-cache-dir-path.outputs.dir }} key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - name: Install YARN packages run: yarn install --immutable - name: Linting files run: yarn lint --no-fix - name: Set development environment variables if: env.IS_PR_DEV == 'true' || env.IS_PUSH_DEV == 'true' run: | echo "NODE_ENV=develop" >> $GITHUB_ENV echo "PROJECT_ALIAS=${{secrets.DEVELOPMENT_PROJECT_ALIAS}}" >> $GITHUB_ENV echo "HOSTING_ALIAS=${{secrets.DEVELOPMENT_HOSTING_ALIAS}}" >> $GITHUB_ENV - name: Set staging environment variables if: env.IS_PUSH_STAGING == 'true' run: | echo "NODE_ENV=staging" >> $GITHUB_ENV echo "PROJECT_ALIAS=${{secrets.STAGING_PROJECT_ALIAS}}" >> $GITHUB_ENV echo "HOSTING_ALIAS=${{secrets.STAGING_HOSTING_ALIAS}}" >> $GITHUB_ENV - name: Set production environment variables if: env.IS_PUSH_PROD == 'true' run: | echo "NODE_ENV=production" >> $GITHUB_ENV echo "PROJECT_ALIAS=${{secrets.PRODUCTION_PROJECT_ALIAS}}" >> $GITHUB_ENV echo "HOSTING_ALIAS=${{secrets.PRODUCTION_HOSTING_ALIAS}}" >> $GITHUB_ENV - run: firebase use ${{ env.PROJECT_ALIAS }} --token ${{ env.FIREBASE_TOKEN }} - run: yarn build - name: Deploy preview channel to Firebase if: github.event_name == 'pull_request' # Deploying to preview channel using the branch name as channel name # String split '/' and use the last part of the branch name run: >- firebase hosting:channel:deploy $(echo ${{ github.head_ref }} | grep -o '[^/]*$') --expires 5d --token ${{ env.FIREBASE_TOKEN }} - name: Deploy to Firebase if: github.event_name == 'push' run: >- firebase deploy --only hosting:${{ env.HOSTING_ALIAS }} -m "Github action run $GITHUB_RUN_ID" --non-interactive --force --token ${{ env.FIREBASE_TOKEN }}