143 lines
4.7 KiB
YAML
143 lines
4.7 KiB
YAML
---
|
|
name: Release Browser
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_type:
|
|
description: 'Release Options'
|
|
required: true
|
|
default: 'Initial Release'
|
|
type: choice
|
|
options:
|
|
- Initial Release
|
|
- Redeploy
|
|
- Dry Run
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
working-directory: apps/browser
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup
|
|
runs-on: ubuntu-20.04
|
|
outputs:
|
|
release-version: ${{ steps.version.outputs.package-version }}
|
|
branch-name: ${{ steps.branch.outputs.branch-name }}
|
|
steps:
|
|
- name: Branch check
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
run: |
|
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ $GITHUB_REF != refs/heads/hotfix-rc/* ]]; then
|
|
echo "==================================="
|
|
echo "[!] Can only release from the 'rc' or 'hotfix-rc/*' branches"
|
|
echo "==================================="
|
|
exit 1
|
|
fi
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
|
|
|
- name: Check Release Version
|
|
id: version
|
|
run: |
|
|
version=$( jq -r ".version" src/manifest.json)
|
|
previous_release_tag_version=$(
|
|
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r 'first(.[] | select(.tag_name | startswith("browser"))).tag_name'
|
|
)
|
|
|
|
if [ "v$version" == "$previous_release_tag_version" ] && \
|
|
[ "${{ github.event.inputs.release_type }}" == "Initial Release" ]; then
|
|
echo "[!] Already released v$version. Please bump version to continue"
|
|
exit 1
|
|
fi
|
|
|
|
echo "::set-output name=package-version::$version"
|
|
|
|
- name: Get branch name
|
|
id: branch
|
|
run: |
|
|
BRANCH_NAME=$(basename ${{ github.ref }})
|
|
echo "::set-output name=branch-name::$BRANCH_NAME"
|
|
|
|
|
|
locales-test:
|
|
name: Locales Test
|
|
runs-on: ubuntu-20.04
|
|
needs: setup
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
|
|
|
- name: Testing locales - extName length
|
|
run: |
|
|
found_error=false
|
|
|
|
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
|
|
|
|
if $found_error; then
|
|
echo
|
|
echo "Please fix 'extName' for the locales listed above."
|
|
exit 1
|
|
else
|
|
echo "Test passed!"
|
|
fi
|
|
|
|
|
|
release:
|
|
name: Create GitHub Release
|
|
runs-on: ubuntu-20.04
|
|
needs:
|
|
- setup
|
|
- locales-test
|
|
steps:
|
|
- name: Download latest RC build artifacts
|
|
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
|
|
with:
|
|
workflow: build-browser.yml
|
|
workflow_conclusion: success
|
|
branch: ${{ needs.setup.outputs.branch-name }}
|
|
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 }}
|
|
run: |
|
|
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
|
|
|
|
- name: Create release
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01
|
|
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: "Version ${{ needs.setup.outputs.release-version }}"
|
|
body: "<insert release notes here>"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
draft: true
|