Update workflows to deploy to CloudFlare Pages (cf-pages branch) (#2936)

This commit is contained in:
Vince Grassia 2022-06-20 15:16:51 -04:00 committed by GitHub
parent 7310fa826e
commit 9dd49a0023
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 7 additions and 78 deletions

View File

@ -5,7 +5,7 @@ on:
pull_request: pull_request:
branches-ignore: branches-ignore:
- 'l10n_master' - 'l10n_master'
- 'gh-pages' - 'cf-pages'
paths: paths:
- 'apps/browser/**' - 'apps/browser/**'
- 'libs/**' - 'libs/**'

View File

@ -5,7 +5,7 @@ on:
pull_request: pull_request:
branches-ignore: branches-ignore:
- 'l10n_master' - 'l10n_master'
- 'gh-pages' - 'cf-pages'
paths: paths:
- 'apps/cli/**' - 'apps/cli/**'
- 'libs/**' - 'libs/**'

View File

@ -5,7 +5,7 @@ on:
pull_request: pull_request:
branches-ignore: branches-ignore:
- 'l10n_master' - 'l10n_master'
- 'gh-pages' - 'cf-pages'
paths: paths:
- 'apps/desktop/**' - 'apps/desktop/**'
- '*' - '*'

View File

@ -5,7 +5,7 @@ on:
pull_request: pull_request:
branches-ignore: branches-ignore:
- 'l10n_master' - 'l10n_master'
- 'gh-pages' - 'cf-pages'
paths: paths:
- 'apps/web/**' - 'apps/web/**'
- 'libs/**' - 'libs/**'

View File

@ -5,7 +5,7 @@ on:
push: push:
branches-ignore: branches-ignore:
- 'l10n_master' - 'l10n_master'
- 'gh-pages' - 'cf-pages'
paths-ignore: paths-ignore:
- '.github/workflows/**' - '.github/workflows/**'
workflow_dispatch: workflow_dispatch:

View File

@ -142,73 +142,6 @@ jobs:
run: docker logout run: docker logout
ghpages-deploy:
name: Deploy Web Vault to GitHub Pages
runs-on: ubuntu-20.04
needs:
- setup
- self-host
env:
_RELEASE_VERSION: ${{ needs.setup.outputs.release_version }}
_TAG_VERSION: ${{ needs.setup.outputs.tag_version }}
steps:
- name: Checkout Repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 # v2.4.0
with:
ref: gh-pages
- name: Create gh-pages-deploy branch
run: |
git switch -c gh-pages-deploy-$_TAG_VERSION
git push -u origin gh-pages-deploy-$_TAG_VERSION
- name: Checkout Repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 # v2.4.0
- name: Setup git config
run: |
git config user.name = "GitHub Action Bot"
git config user.email = "<>"
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
git config --global url."https://".insteadOf ssh://
- name: Download latest cloud asset
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
with:
workflow: build-web.yml
path: apps/web
workflow_conclusion: success
branch: ${{ needs.setup.outputs.branch_name }}
artifacts: web-*-cloud-COMMERCIAL.zip
# This should result in a build directory in the current working directory
- name: Unzip build asset
working-directory: apps/web
run: unzip web-*-cloud-COMMERCIAL.zip
- name: Deploy GitHub Pages
uses: crazy-max/ghaction-github-pages@eb08c35b9fab86751edfff4e55cd5cde35ff0e52 # v3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target_branch: gh-pages-deploy-${{ needs.setup.outputs.tag_version }}
build_dir: apps/web/build
keep_history: true
commit_message: "Staging deploy ${{ needs.setup.outputs.release_version }}"
dry_run: ${{ github.event.inputs.release_type == 'Dry Run' }}
- name: Create GitHub Pages Deploy PR
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
env:
PR_BRANCH: gh-pages-deploy-${{ env._TAG_VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --title "Deploy $_RELEASE_VERSION to GitHub Pages" \
--body "Deploying $_RELEASE_VERSION" \
--base gh-pages \
--head "$PR_BRANCH"
cfpages-deploy: cfpages-deploy:
name: Deploy Web Vault to CloudFlare Pages branch name: Deploy Web Vault to CloudFlare Pages branch
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@ -239,7 +172,7 @@ jobs:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
with: with:
ref: deploy ref: cf-pages
path: deployment path: deployment
- name: Setup git config - name: Setup git config
@ -271,7 +204,7 @@ jobs:
run: | run: |
gh pr create --title "Deploy $_RELEASE_VERSION to CloudFlare Pages" \ gh pr create --title "Deploy $_RELEASE_VERSION to CloudFlare Pages" \
--body "Deploying $_RELEASE_VERSION" \ --body "Deploying $_RELEASE_VERSION" \
--base deploy \ --base cf-pages \
--head "$PR_BRANCH" --head "$PR_BRANCH"
@ -281,7 +214,6 @@ jobs:
needs: needs:
- setup - setup
- self-host - self-host
- ghpages-deploy
- cfpages-deploy - cfpages-deploy
steps: steps:
- name: Download latest build artifacts - name: Download latest build artifacts
@ -327,8 +259,5 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Remove gh-pages-deploy branch
run: git push origin --delete gh-pages-deploy-$_TAG_VERSION
- name: Remove cf-pages-deploy branch - name: Remove cf-pages-deploy branch
run: git push origin --delete cf-pages-deploy-$_TAG_VERSION run: git push origin --delete cf-pages-deploy-$_TAG_VERSION