mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-29 07:59:42 +01:00
129 lines
4.5 KiB
YAML
129 lines
4.5 KiB
YAML
---
|
|
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs: {}
|
|
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup
|
|
runs-on: ubuntu-20.04
|
|
outputs:
|
|
release-version: ${{ steps.version.outputs.package-version }}
|
|
steps:
|
|
- name: Branch check
|
|
run: |
|
|
if [[ "$GITHUB_REF" != "refs/heads/release" ]]; then
|
|
echo "==================================="
|
|
echo "[!] Can only release from the 'release' branch"
|
|
echo "==================================="
|
|
exit 1
|
|
fi
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
|
with:
|
|
ref: release
|
|
|
|
- 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/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::$version"
|
|
|
|
|
|
locales-test:
|
|
name: Locales Test
|
|
runs-on: ubuntu-20.04
|
|
needs: setup
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
|
|
|
- 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: Get build number
|
|
id: get-build-commit
|
|
run: |
|
|
build_commit=$(ls browser-source-* | cut -d '.' -f 1 | cut -d '-' -f 3)
|
|
echo "::set-output name=build-commit::$build_commit"
|
|
|
|
- name: Download latest RC build artifacts
|
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
|
with:
|
|
workflow: build.yml
|
|
workflow_conclusion: success
|
|
branch: release
|
|
artifacts: 'browser-source-${{ steps.get-build-commit.outputs.build-commit }}.zip,
|
|
dist-chrome-${{ steps.get-build-commit.outputs.build-commit }}.zip,
|
|
dist-opera-${{ steps.get-build-commit.outputs.build-commit }}.zip,
|
|
dist-firefox-${{ steps.get-build-commit.outputs.build-commit }}.zip,
|
|
dist-edge-${{ steps.get-build-commit.outputs.build-commit }}.zip'
|
|
|
|
- name: Rename build artifacts
|
|
env:
|
|
BUILD_COMMIT: ${{ steps.get-build-commit.outputs.build-commit }}
|
|
PACKAGE_VERSION: ${{ needs.setup.outputs.release-version }}
|
|
run: |
|
|
mv browser-source-$BUILD_COMMIT.zip browser-source-$PACKAGE_VERSION.zip
|
|
mv dist-chrome-$BUILD_COMMIT.zip dist-chrome-$PACKAGE_VERSION.zip
|
|
mv dist-opera-$BUILD_COMMIT.zip dist-opera-$PACKAGE_VERSION.zip
|
|
mv dist-firefox-$BUILD_COMMIT.zip dist-firefox-$PACKAGE_VERSION.zip
|
|
mv dist-edge-$BUILD_COMMIT.zip dist-edge-$PACKAGE_VERSION.zip
|
|
|
|
- name: Create release
|
|
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09
|
|
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: "v${{ needs.setup.outputs.release-version }}"
|
|
name: "Version ${{ needs.setup.outputs.release-version }}"
|
|
body: "<insert release notes here>"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
draft: true
|