2021-09-02 22:03:47 +02:00
|
|
|
---
|
2022-05-03 20:01:37 +02:00
|
|
|
name: Release Browser
|
2022-11-08 16:02:51 +01:00
|
|
|
run-name: Release Browser ${{ inputs.release_type }}
|
2021-02-02 21:14:33 +01:00
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2021-12-20 19:10:52 +01:00
|
|
|
inputs:
|
|
|
|
release_type:
|
|
|
|
description: 'Release Options'
|
|
|
|
required: true
|
|
|
|
default: 'Initial Release'
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- Initial Release
|
|
|
|
- Redeploy
|
2022-02-24 18:26:57 +01:00
|
|
|
- Dry Run
|
2021-02-02 21:14:33 +01:00
|
|
|
|
2022-05-03 20:01:37 +02:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
2021-02-02 21:14:33 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
2021-09-02 22:03:47 +02:00
|
|
|
name: Setup
|
2023-09-06 15:51:40 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-02-02 21:14:33 +01:00
|
|
|
outputs:
|
2022-06-01 19:03:05 +02:00
|
|
|
release-version: ${{ steps.version.outputs.version }}
|
2021-02-02 21:14:33 +01:00
|
|
|
steps:
|
2022-06-30 19:26:35 +02:00
|
|
|
- name: Checkout repo
|
2023-06-29 16:46:56 +02:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2022-06-30 19:26:35 +02:00
|
|
|
|
2021-06-01 20:15:52 +02:00
|
|
|
- name: Branch check
|
2022-02-24 18:26:57 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2021-06-01 20:15:52 +02:00
|
|
|
run: |
|
2022-11-16 16:48:49 +01:00
|
|
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc-browser" ]]; then
|
2021-06-01 20:15:52 +02:00
|
|
|
echo "==================================="
|
2022-08-16 17:55:57 +02:00
|
|
|
echo "[!] Can only release from the 'rc' or 'hotfix-rc-browser' branches"
|
2021-06-01 20:15:52 +02:00
|
|
|
echo "==================================="
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-09-02 22:03:47 +02:00
|
|
|
|
2021-09-28 00:55:53 +02:00
|
|
|
- name: Check Release Version
|
|
|
|
id: version
|
2023-11-08 19:08:34 +01:00
|
|
|
uses: bitwarden/gh-actions/release-version-check@main
|
2022-06-01 19:03:05 +02:00
|
|
|
with:
|
|
|
|
release-type: ${{ github.event.inputs.release_type }}
|
|
|
|
project-type: ts
|
|
|
|
file: apps/browser/src/manifest.json
|
|
|
|
monorepo: true
|
|
|
|
monorepo-project: browser
|
2021-02-02 21:14:33 +01:00
|
|
|
|
|
|
|
|
2021-05-13 01:52:27 +02:00
|
|
|
locales-test:
|
2021-09-02 22:03:47 +02:00
|
|
|
name: Locales Test
|
2023-09-06 15:51:40 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-02-02 21:14:33 +01:00
|
|
|
needs: setup
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2023-06-29 16:46:56 +02:00
|
|
|
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
2021-02-02 21:14:33 +01:00
|
|
|
|
2021-05-13 23:08:18 +02:00
|
|
|
- name: Testing locales - extName length
|
2021-05-13 00:41:34 +02:00
|
|
|
run: |
|
2022-06-01 21:36:16 +02:00
|
|
|
found_error=false
|
2021-05-13 00:41:34 +02:00
|
|
|
|
2022-06-01 21:36:16 +02:00
|
|
|
echo "Locales Test"
|
|
|
|
echo "============"
|
|
|
|
echo "extName string must be 40 characters or less"
|
|
|
|
echo
|
|
|
|
for locale in $(ls src/_locales/); do
|
|
|
|
string_length=$(jq '.extName.message | length' src/_locales/$locale/messages.json)
|
|
|
|
if [[ $string_length -gt 40 ]]; then
|
|
|
|
echo "$locale: $string_length"
|
|
|
|
found_error=true
|
|
|
|
fi
|
|
|
|
done
|
2021-05-13 00:41:34 +02:00
|
|
|
|
2022-06-01 21:36:16 +02:00
|
|
|
if $found_error; then
|
|
|
|
echo
|
|
|
|
echo "Please fix 'extName' for the locales listed above."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "Test passed!"
|
|
|
|
fi
|
|
|
|
working-directory: apps/browser
|
2021-05-13 01:52:27 +02:00
|
|
|
|
|
|
|
|
2021-09-28 00:55:53 +02:00
|
|
|
release:
|
|
|
|
name: Create GitHub Release
|
2023-09-06 15:51:40 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-09-28 00:55:53 +02:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- locales-test
|
|
|
|
steps:
|
2022-07-25 23:20:17 +02:00
|
|
|
- name: Create GitHub deployment
|
2023-05-05 22:17:19 +02:00
|
|
|
uses: chrnorm/deployment-action@d42cde7132fcec920de534fffc3be83794335c00 # v2.0.5
|
2022-07-25 23:20:17 +02:00
|
|
|
id: deployment
|
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
2022-08-08 19:21:49 +02:00
|
|
|
initial-status: 'in_progress'
|
2022-07-25 23:20:17 +02:00
|
|
|
environment: 'Browser - Production'
|
|
|
|
description: 'Deployment ${{ needs.setup.outputs.release-version }} from branch ${{ github.ref_name }}'
|
|
|
|
task: release
|
|
|
|
|
2022-07-01 17:44:20 +02:00
|
|
|
- name: Download latest Release build artifacts
|
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2023-11-08 19:08:34 +01:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@main
|
2021-05-13 01:52:27 +02:00
|
|
|
with:
|
2022-05-03 20:01:37 +02:00
|
|
|
workflow: build-browser.yml
|
2021-09-28 00:55:53 +02:00
|
|
|
workflow_conclusion: success
|
2022-06-22 14:32:45 +02:00
|
|
|
branch: ${{ github.ref_name }}
|
2021-10-27 20:46:37 +02:00
|
|
|
artifacts: 'browser-source-*.zip,
|
|
|
|
dist-chrome-*.zip,
|
|
|
|
dist-opera-*.zip,
|
|
|
|
dist-firefox-*.zip,
|
|
|
|
dist-edge-*.zip'
|
2021-10-27 20:01:02 +02:00
|
|
|
|
2022-11-14 15:35:42 +01:00
|
|
|
- name: Dry Run - Download latest master build artifacts
|
2022-07-01 17:44:20 +02:00
|
|
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
2023-11-08 19:08:34 +01:00
|
|
|
uses: bitwarden/gh-actions/download-artifacts@main
|
2022-07-01 17:44:20 +02:00
|
|
|
with:
|
|
|
|
workflow: build-browser.yml
|
|
|
|
workflow_conclusion: success
|
|
|
|
branch: master
|
|
|
|
artifacts: 'browser-source-*.zip,
|
|
|
|
dist-chrome-*.zip,
|
|
|
|
dist-opera-*.zip,
|
|
|
|
dist-firefox-*.zip,
|
|
|
|
dist-edge-*.zip'
|
|
|
|
|
2021-10-27 20:01:02 +02:00
|
|
|
- name: Rename build artifacts
|
|
|
|
env:
|
|
|
|
PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }}
|
2021-05-26 22:34:31 +02:00
|
|
|
run: |
|
2021-10-27 20:46:37 +02:00
|
|
|
mv browser-source.zip browser-source-$PACKAGE_VERSION.zip
|
|
|
|
mv dist-chrome.zip dist-chrome-$PACKAGE_VERSION.zip
|
|
|
|
mv dist-opera.zip dist-opera-$PACKAGE_VERSION.zip
|
|
|
|
mv dist-firefox.zip dist-firefox-$PACKAGE_VERSION.zip
|
|
|
|
mv dist-edge.zip dist-edge-$PACKAGE_VERSION.zip
|
2021-05-26 22:34:31 +02:00
|
|
|
|
2021-09-28 00:55:53 +02:00
|
|
|
- name: Create release
|
2022-02-24 18:26:57 +01:00
|
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
2023-05-05 22:17:19 +02:00
|
|
|
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # v1.12.0
|
2021-02-02 21:14:33 +01:00
|
|
|
with:
|
2021-10-27 20:01:02 +02:00
|
|
|
artifacts: 'browser-source-${{ needs.setup.outputs.release-version }}.zip,
|
|
|
|
dist-chrome-${{ needs.setup.outputs.release-version }}.zip,
|
|
|
|
dist-opera-${{ needs.setup.outputs.release-version }}.zip,
|
|
|
|
dist-firefox-${{ needs.setup.outputs.release-version }}.zip,
|
|
|
|
dist-edge-${{ needs.setup.outputs.release-version }}.zip'
|
2021-09-28 00:55:53 +02:00
|
|
|
commit: ${{ github.sha }}
|
2022-05-03 20:01:37 +02:00
|
|
|
tag: "browser-v${{ needs.setup.outputs.release-version }}"
|
2022-05-31 15:20:06 +02:00
|
|
|
name: "Browser v${{ needs.setup.outputs.release-version }}"
|
2021-09-28 00:55:53 +02:00
|
|
|
body: "<insert release notes here>"
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
draft: true
|
2022-07-25 23:20:17 +02:00
|
|
|
|
|
|
|
- name: Update deployment status to Success
|
2022-08-08 19:21:49 +02:00
|
|
|
if: ${{ success() }}
|
2023-05-05 22:17:19 +02:00
|
|
|
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
2022-07-25 23:20:17 +02:00
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
state: 'success'
|
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
|
|
|
|
- name: Update deployment status to Failure
|
2022-08-08 19:21:49 +02:00
|
|
|
if: ${{ failure() }}
|
2023-05-05 22:17:19 +02:00
|
|
|
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
2022-07-25 23:20:17 +02:00
|
|
|
with:
|
|
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
|
|
state: 'failure'
|
|
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|