DEVOPS-758 - Move Web deploy from GitHub Pages to CloudFlare Pages (#1627)
This commit is contained in:
parent
f8d942c02c
commit
1c31d090a3
|
@ -11,6 +11,7 @@ on:
|
||||||
branches-ignore:
|
branches-ignore:
|
||||||
- "l10n_master"
|
- "l10n_master"
|
||||||
- "gh-pages"
|
- "gh-pages"
|
||||||
|
- "deploy"
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- '.github/workflows/**'
|
- '.github/workflows/**'
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ jobs:
|
||||||
|
|
||||||
|
|
||||||
ghpages-deploy:
|
ghpages-deploy:
|
||||||
name: Deploy Web Vault
|
name: Deploy Web Vault to GitHub Pages
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
|
@ -172,10 +172,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
ref: gh-pages
|
ref: gh-pages
|
||||||
|
|
||||||
- name: Create deploy branch
|
- name: Create gh-pages-deploy branch
|
||||||
run: |
|
run: |
|
||||||
git switch -c deploy-$_TAG_VERSION
|
git switch -c gh-pages-deploy-$_TAG_VERSION
|
||||||
git push -u origin deploy-$_TAG_VERSION
|
git push -u origin gh-pages-deploy-$_TAG_VERSION
|
||||||
|
|
||||||
- name: Checkout Repo
|
- name: Checkout Repo
|
||||||
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
||||||
|
@ -204,24 +204,88 @@ jobs:
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
target_branch: deploy-${{ needs.setup.outputs.tag_version }}
|
target_branch: gh-pages-deploy-${{ needs.setup.outputs.tag_version }}
|
||||||
build_dir: build
|
build_dir: build
|
||||||
keep_history: true
|
keep_history: true
|
||||||
commit_message: "Staging deploy ${{ needs.setup.outputs.release_version }}"
|
commit_message: "Staging deploy ${{ needs.setup.outputs.release_version }}"
|
||||||
dry_run: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
dry_run: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
||||||
|
|
||||||
- name: Create Deploy PR
|
- name: Create GitHub Pages Deploy PR
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
env:
|
env:
|
||||||
PR_BRANCH: deploy-${{ env._TAG_VERSION }}
|
PR_BRANCH: gh-pages-deploy-${{ env._TAG_VERSION }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
gh pr create --title "Deploy $_RELEASE_VERSION" \
|
gh pr create --title "Deploy $_RELEASE_VERSION to GitHub Pages" \
|
||||||
--body "Deploying $_RELEASE_VERSION" \
|
--body "Deploying $_RELEASE_VERSION" \
|
||||||
--base gh-pages \
|
--base gh-pages \
|
||||||
--head "$PR_BRANCH"
|
--head "$PR_BRANCH"
|
||||||
|
|
||||||
|
|
||||||
|
cfpages-deploy:
|
||||||
|
name: Deploy Web Vault to CloudFlare Pages branch
|
||||||
|
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@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
||||||
|
|
||||||
|
- name: Download latest cloud asset
|
||||||
|
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
|
||||||
|
with:
|
||||||
|
workflow: build.yml
|
||||||
|
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
|
||||||
|
run: unzip web-*-cloud-COMMERCIAL.zip
|
||||||
|
|
||||||
|
- name: Checkout Repo
|
||||||
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
|
||||||
|
with:
|
||||||
|
ref: deploy
|
||||||
|
path: deployment
|
||||||
|
|
||||||
|
- name: Setup git config
|
||||||
|
run: |
|
||||||
|
git config --global user.name = "GitHub Action Bot"
|
||||||
|
git config --global user.email = "<>"
|
||||||
|
git config --global url."https://github.com/".insteadOf ssh://git@github.com/
|
||||||
|
git config --global url."https://".insteadOf ssh://
|
||||||
|
|
||||||
|
- name: Deploy CloudFlare Pages
|
||||||
|
run: |
|
||||||
|
rm -rf ./*
|
||||||
|
cp -R ../build/* .
|
||||||
|
working-directory: deployment
|
||||||
|
|
||||||
|
- name: Create cf-pages-deploy branch
|
||||||
|
run: |
|
||||||
|
git switch -c cf-pages-deploy-$_TAG_VERSION
|
||||||
|
git add .
|
||||||
|
git commit -m "Staging deploy ${{ needs.setup.outputs.release_version }}"
|
||||||
|
git push -u origin cf-pages-deploy-$_TAG_VERSION
|
||||||
|
working-directory: deployment
|
||||||
|
|
||||||
|
- name: Create CloudFlare Pages Deploy PR
|
||||||
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
|
env:
|
||||||
|
PR_BRANCH: cf-pages-deploy-${{ env._TAG_VERSION }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
gh pr create --title "Deploy $_RELEASE_VERSION to CloudFlare Pages" \
|
||||||
|
--body "Deploying $_RELEASE_VERSION" \
|
||||||
|
--base deploy \
|
||||||
|
--head "$PR_BRANCH"
|
||||||
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create GitHub Release
|
name: Create GitHub Release
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
@ -229,6 +293,7 @@ jobs:
|
||||||
- setup
|
- setup
|
||||||
- self-host
|
- self-host
|
||||||
- ghpages-deploy
|
- ghpages-deploy
|
||||||
|
- cfpages-deploy
|
||||||
steps:
|
steps:
|
||||||
- name: Download latest build artifacts
|
- name: Download latest build artifacts
|
||||||
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
||||||
|
@ -271,5 +336,8 @@ jobs:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # 2.4.0
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # 2.4.0
|
||||||
|
|
||||||
- name: Remove deploy branch
|
- name: Remove gh-pages-deploy branch
|
||||||
run: git push origin --delete deploy-$_TAG_VERSION
|
run: git push origin --delete gh-pages-deploy-$_TAG_VERSION
|
||||||
|
|
||||||
|
- name: Remove cf-pages-deploy branch
|
||||||
|
run: git push origin --delete cf-pages-deploy-$_TAG_VERSION
|
||||||
|
|
Loading…
Reference in New Issue