mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-08 09:43:42 +01:00
ab0ce71db8
* starting the new pipeline model update * updating the deploy portion of the pipeline * adding a stub for the release notes * removing the redundant deploy workflow * fixing the cloud job. Adding a npm pre-cache * updating the hashFile for the caches * removing the cache-hit check since the logic doesn't work for node_modules * checking out the repo in the precache * removing the pre-cache step. Seems to slow down the pipeline overall * ghpage-deploy with the correct input for the versions * testing a custom action for the DCT setup * fixing a typo * fixing the shell issue in the custom action * removing a conditional to run a test * testing redaction * fixing the weird colon inline with run issue * commenting out the DCT for testing * test passed. Updating the release pipeline with the new Setup DCT action * updating the DCT setup action hash * updating the release workflow with the linter suggestions
179 lines
5.5 KiB
YAML
179 lines
5.5 KiB
YAML
---
|
|
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs: {}
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup
|
|
runs-on: ubuntu-20.04
|
|
outputs:
|
|
release_upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
release_version: ${{ steps.create_tags.outputs.package }}
|
|
tag_version: ${{ steps.create_tags.outputs.tag }}
|
|
steps:
|
|
- name: Branch check
|
|
run: |
|
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]]; then
|
|
echo "==================================="
|
|
echo "[!] Can only release from rc branch"
|
|
echo "==================================="
|
|
exit 1
|
|
fi
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4
|
|
|
|
- name: Check Release Version
|
|
id: version
|
|
run: |
|
|
version=$( jq -r ".version" package.json)
|
|
previous_release_tag_version=$(
|
|
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -r ".tag_name"
|
|
)
|
|
|
|
if [ "v$version" == "$previous_release_tag_version" ]; then
|
|
echo "[!] Already released v$version. Please bump version to continue"
|
|
exit 1
|
|
fi
|
|
|
|
echo "::set-output name=package::$version"
|
|
echo "::set-output name=tag::v$version"
|
|
|
|
|
|
self-host:
|
|
name: Build self-host docker
|
|
runs-on: ubuntu-20.04
|
|
needs: setup
|
|
env:
|
|
_RELEASE_VERSION: ${{ needs.setup.outputs.release_version }}
|
|
steps:
|
|
- name: Print environment
|
|
run: |
|
|
whoami
|
|
docker --version
|
|
echo "GitHub ref: $GITHUB_REF"
|
|
echo "GitHub event: $GITHUB_EVENT"
|
|
|
|
- name: Setup DCT
|
|
id: setup-dct
|
|
uses: bitwarden/gh-actions/setup-docker-trust@a8c384a05a974c05c48374c818b004be221d43ff
|
|
with:
|
|
azure-creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
azure-keyvault-name: "bitwarden-prod-kv"
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
|
|
|
- name: Pull latest selfhost rc image
|
|
run: docker pull bitwarden/web:rc
|
|
|
|
- name: Tag version
|
|
run: |
|
|
docker tag bitwarden/web:rc bitwarden/web:latest
|
|
docker tag bitwarden/web:rc bitwarden/web:$_RELEASE_VERSION
|
|
|
|
- name: List Docker images
|
|
run: docker images
|
|
|
|
- name: Push images
|
|
run: |
|
|
docker push bitwarden/web:latest
|
|
docker push bitwarden/web:$_RELEASE_VERSION
|
|
env:
|
|
DOCKER_CONTENT_TRUST: 1
|
|
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
|
|
|
|
- name: Log out of Docker
|
|
run: docker logout
|
|
|
|
|
|
ghpages-deploy:
|
|
name: Deploy Web Vault
|
|
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@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
|
with:
|
|
ref: gh-pages
|
|
|
|
- name: Create deploy branch
|
|
run: |
|
|
git switch -c deploy-$_TAG_VERSION
|
|
git push -u origin deploy-$_TAG_VERSION
|
|
git switch rc
|
|
|
|
- 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 RC Production build
|
|
uses: dawidd6/action-download-artifact@b9571484721e8187f1fd08147b497129f8972c74 # v2.14.0
|
|
with:
|
|
workflow: build.yml
|
|
workflow_conclusion: success
|
|
branch: rc
|
|
name: prod-build-artifact.zip
|
|
|
|
# This should result in a build directory in the current working directory
|
|
- name: Unzip build asset
|
|
run: unzip prod-build-artifact.zip
|
|
|
|
- name: Deploy GitHub Pages
|
|
uses: crazy-max/ghaction-github-pages@db4476a01402e1a7ce05f41832040eef16d14925 # v2.5.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
target_branch: deploy-${{ needs.setup.outputs.tag_version }}
|
|
build_dir: build
|
|
keep_history: true
|
|
commit_message: "Staging deploy ${{ needs.setup.outputs.release_version }}"
|
|
|
|
- name: Create Deploy PR
|
|
env:
|
|
PR_BRANCH: deploy-${{ env._TAG_VERSION }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
gh pr create --title "Deploy $_RELEASE_VERSION" \
|
|
--body "Deploying $_RELEASE_VERSION" \
|
|
--base gh-pages \
|
|
--head "$PR_BRANCH"
|
|
|
|
|
|
release:
|
|
name: Create GitHub Release
|
|
runs-on: ubuntu-20.04
|
|
needs:
|
|
- setup
|
|
- self-host
|
|
- ghpages-deploy
|
|
steps:
|
|
- name: Download latest RC Production build
|
|
uses: dawidd6/action-download-artifact@b9571484721e8187f1fd08147b497129f8972c74 # v2.14.0
|
|
with:
|
|
workflow: build.yml
|
|
workflow_conclusion: success
|
|
branch: rc
|
|
name: prod-build-artifact.zip
|
|
|
|
- name: Create release
|
|
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09
|
|
with:
|
|
artifacts: prod-build-artifact.zip
|
|
commit: ${{ github.sha }}
|
|
tag: "${{ needs.version.outputs.tag_version }}"
|
|
name: "Version ${{ needs.version.outputs.release_version }}"
|
|
body: "<insert release notes here>"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|