1
0
mirror of https://github.com/bitwarden/browser synced 2024-12-27 18:34:29 +01:00
bitwarden-estensione-browser/.github/workflows/release-browser.yml

171 lines
5.8 KiB
YAML
Raw Normal View History

---
name: Release Browser
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
defaults:
run:
shell: bash
2021-02-02 21:14:33 +01:00
jobs:
setup:
name: Setup
runs-on: ubuntu-22.04
2021-02-02 21:14:33 +01:00
outputs:
release-version: ${{ steps.version.outputs.version }}
2021-02-02 21:14:33 +01:00
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Branch check
2022-02-24 18:26:57 +01:00
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
run: |
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc-browser" ]]; then
echo "==================================="
echo "[!] Can only release from the 'rc' or 'hotfix-rc-browser' branches"
echo "==================================="
exit 1
fi
- name: Check Release Version
id: version
2023-11-08 19:08:34 +01:00
uses: bitwarden/gh-actions/release-version-check@main
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
locales-test:
name: Locales Test
runs-on: ubuntu-22.04
2021-02-02 21:14:33 +01:00
needs: setup
steps:
- name: Checkout repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2021-02-02 21:14:33 +01:00
- name: Testing locales - extName length
run: |
2022-06-01 21:36:16 +02:00
found_error=false
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
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
release:
name: Create GitHub Release
runs-on: ubuntu-22.04
needs:
- setup
- locales-test
steps:
- name: Create GitHub deployment
uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7
id: deployment
with:
token: '${{ secrets.GITHUB_TOKEN }}'
initial-status: 'in_progress'
environment: 'Browser - Production'
description: 'Deployment ${{ needs.setup.outputs.release-version }} from branch ${{ github.ref_name }}'
task: release
- 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
with:
workflow: build-browser.yml
workflow_conclusion: success
2022-06-22 14:32:45 +02:00
branch: ${{ github.ref_name }}
artifacts: 'browser-source-*.zip,
dist-chrome-*.zip,
dist-opera-*.zip,
dist-firefox-*.zip,
dist-edge-*.zip'
- name: Dry Run - Download latest 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
with:
workflow: build-browser.yml
workflow_conclusion: success
branch: main
artifacts: 'browser-source-*.zip,
dist-chrome-*.zip,
dist-opera-*.zip,
dist-firefox-*.zip,
dist-edge-*.zip'
- name: Rename build artifacts
env:
PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }}
2021-05-26 22:34:31 +02:00
run: |
mv browser-source.zip browser-source-$PACKAGE_VERSION.zip
2024-06-14 21:20:17 +02:00
mv dist-chrome-mv3.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
- name: Create release
2022-02-24 18:26:57 +01:00
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
2021-02-02 21:14:33 +01:00
with:
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'
commit: ${{ github.sha }}
tag: "browser-v${{ needs.setup.outputs.release-version }}"
name: "Browser v${{ needs.setup.outputs.release-version }}"
body: "<insert release notes here>"
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
- name: Update deployment status to Success
if: ${{ success() }}
uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3
with:
token: '${{ secrets.GITHUB_TOKEN }}'
state: 'success'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
- name: Update deployment status to Failure
if: ${{ failure() }}
uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3
with:
token: '${{ secrets.GITHUB_TOKEN }}'
state: 'failure'
deployment-id: ${{ steps.deployment.outputs.deployment_id }}