bitwarden-estensione-browser/.github/workflows/release.yml

118 lines
3.6 KiB
YAML
Raw Normal View History

---
2021-02-02 22:32:27 +01:00
name: Release
2021-02-02 21:14:33 +01:00
on:
workflow_dispatch:
inputs: {}
2021-02-02 21:14:33 +01:00
jobs:
setup:
name: Setup
runs-on: ubuntu-20.04
2021-02-02 21:14:33 +01:00
outputs:
release-version: ${{ steps.version.outputs.package-version }}
2021-02-02 21:14:33 +01:00
steps:
- name: Branch check
run: |
if [[ "$GITHUB_REF" != "refs/heads/rc" ]]; then
echo "==================================="
echo "[!] Can only release from rc branch"
echo "==================================="
exit 1
fi
2021-02-02 21:14:33 +01:00
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
ref: rc
2021-02-02 21:14:33 +01:00
- name: Check Release Version
id: version
2021-02-02 21:14:33 +01:00
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"
)
2021-02-02 21:14:33 +01:00
if [ "v$version" == "$previous_release_tag_version" ]; then
echo "[!] Already released v$version. Please bump version to continue"
exit 1
fi
2021-02-02 22:27:15 +01:00
echo "::set-output name=package-version::$version"
2021-02-02 21:14:33 +01:00
locales-test:
name: Locales Test
runs-on: ubuntu-20.04
2021-02-02 21:14:33 +01:00
needs: setup
steps:
- name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
2021-02-02 21:14:33 +01:00
- 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@23433be15ed6fd046ce12b6889c5184a8d9c8783
with:
workflow: build.yml
workflow_conclusion: success
branch: rc
artifacts: 'browser-source-*.zip,
dist-chrome-*.zip,
dist-opera-*.zip,
dist-firefox-*.zip,
dist-edge-*.zip'
- name: Get build number
id: get-build-number
2021-05-26 22:34:31 +02:00
run: |
build_num=$(ls browser-source-* | grep -oE "[0-9]+")
echo "::set-output name=build-number::$build_num"
2021-05-26 22:34:31 +02:00
- name: Create release
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09
2021-02-02 21:14:33 +01:00
with:
artifacts: 'browser-source-${{ steps.get-build-number.outputs.build-number }}.zip,
dist-chrome-${{ steps.get-build-number.outputs.build-number }}.zip,
dist-opera-${{ steps.get-build-number.outputs.build-number }}.zip,
dist-firefox-${{ steps.get-build-number.outputs.build-number }}.zip,
dist-edge-${{ steps.get-build-number.outputs.build-number }}.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