Switching to use the Release Version Check to validate the release versions (#2763)

This commit is contained in:
Joseph Flinn 2022-06-01 10:03:05 -07:00 committed by GitHub
parent 8de7f522c6
commit e68272e445
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 70 deletions

View File

@ -24,7 +24,7 @@ jobs:
name: Setup name: Setup
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
outputs: outputs:
release-version: ${{ steps.version.outputs.package-version }} release-version: ${{ steps.version.outputs.version }}
branch-name: ${{ steps.branch.outputs.branch-name }} branch-name: ${{ steps.branch.outputs.branch-name }}
steps: steps:
- name: Branch check - name: Branch check
@ -42,19 +42,13 @@ jobs:
- name: Check Release Version - name: Check Release Version
id: version id: version
run: | uses: bitwarden/gh-actions/release-version-check@ea9fab01d76940267b4147cc1c4542431246b9f6
version=$( jq -r ".version" src/manifest.json) with:
previous_release_tag_version=$( release-type: ${{ github.event.inputs.release_type }}
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r 'first(.[] | select(.tag_name | startswith("browser"))).tag_name' project-type: ts
) file: apps/browser/src/manifest.json
monorepo: true
if [ "v$version" == "$previous_release_tag_version" ] && \ monorepo-project: browser
[ "${{ 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 - name: Get branch name
id: branch id: branch

View File

@ -23,7 +23,7 @@ jobs:
name: Setup name: Setup
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
outputs: outputs:
package_version: ${{ steps.retrieve-version.outputs.package_version }} release-version: ${{ steps.version.outputs.version }}
branch-name: ${{ steps.branch.outputs.branch-name }} branch-name: ${{ steps.branch.outputs.branch-name }}
steps: steps:
- name: Branch check - name: Branch check
@ -39,29 +39,15 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Retrieve CLI release version - name: Check Release Version
id: retrieve-version id: version
run: | uses: bitwarden/gh-actions/release-version-check@ea9fab01d76940267b4147cc1c4542431246b9f6
PKG_VERSION=$(jq -r .version package.json) with:
echo "::set-output name=package_version::$PKG_VERSION" release-type: ${{ github.event.inputs.release_type }}
project-type: ts
- name: Check to make sure CLI release version has been bumped file: apps/cli/package.json
if: ${{ github.event.inputs.release_type == 'Initial Release' }} monorepo: true
env: monorepo-project: cli
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
latest_ver=$(
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r 'first(.[] | select(.tag_name | startswith("cli"))).tag_name'
)
latest_ver=${latest_ver:1}
echo "Latest version: $latest_ver"
ver=${{ steps.retrieve-version.outputs.package_version }}
echo "Version: $ver"
if [ "$latest_ver" = "$ver" ]; then
echo "Version has not been bumped!"
exit 1
fi
shell: bash
- name: Get branch name - name: Get branch name
id: branch id: branch
@ -80,7 +66,7 @@ jobs:
- name: Create release - name: Create release
uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37 # v1.10.0 uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37 # v1.10.0
env: env:
PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }} PKG_VERSION: ${{ steps.version.outputs.version }}
with: with:
artifacts: "apps/cli/bw-windows-${{ env.PKG_VERSION }}.zip, artifacts: "apps/cli/bw-windows-${{ env.PKG_VERSION }}.zip,
apps/cli/bw-windows-sha256-${{ env.PKG_VERSION }}.txt, apps/cli/bw-windows-sha256-${{ env.PKG_VERSION }}.txt,
@ -104,7 +90,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: setup needs: setup
env: env:
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} _PKG_VERSION: ${{ needs.setup.outputs.release-version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
@ -147,7 +133,7 @@ jobs:
runs-on: windows-2019 runs-on: windows-2019
needs: setup needs: setup
env: env:
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} _PKG_VERSION: ${{ needs.setup.outputs.release-version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
@ -183,7 +169,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: setup needs: setup
env: env:
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} _PKG_VERSION: ${{ needs.setup.outputs.release-version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

View File

@ -13,7 +13,6 @@ on:
- Initial Release - Initial Release
- Redeploy - Redeploy
- Dry Run - Dry Run
defaults: defaults:
run: run:
shell: bash shell: bash
@ -24,7 +23,7 @@ jobs:
name: Setup name: Setup
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
outputs: outputs:
package_version: ${{ steps.retrieve-version.outputs.package_version }} release-version: ${{ steps.version.outputs.verison }}
branch-name: ${{ steps.branch.outputs.branch-name }} branch-name: ${{ steps.branch.outputs.branch-name }}
steps: steps:
- name: Branch check - name: Branch check
@ -40,28 +39,15 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
- name: Get Package Version - name: Check Release Version
id: retrieve-version id: version
run: | uses: bitwarden/gh-actions/release-version-check@ea9fab01d76940267b4147cc1c4542431246b9f6
PKG_VERSION=$(jq -r .version src/package.json) with:
echo "::set-output name=package_version::$PKG_VERSION" release-type: ${{ github.event.inputs.release_type }}
project-type: ts
- name: Check to make sure Desktop release version has been bumped file: apps/desktop/src/package.json
env: monorepo: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} monorepo-project: desktop
run: |
latest_ver=$(
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r 'first(.[] | select(.tag_name | startswith("desktop"))).tag_name'
)
latest_ver=${latest_ver:1}
echo "Latest version: $latest_ver"
ver=${{ steps.retrieve-version.outputs.package_version }}
echo "Version: $ver"
if [ "$latest_ver" = "$ver" ] && \
[ "${{ github.event.inputs.release_type }}" == "Initial Release" ]; then
echo "Version has not been bumped!"
exit 1
fi
- name: Get branch name - name: Get branch name
id: branch id: branch
@ -91,7 +77,7 @@ jobs:
- name: Rename .pkg to .pkg.archive - name: Rename .pkg to .pkg.archive
env: env:
PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }} PKG_VERSION: ${{ steps.version.outputs.version }}
working-directory: ./artifacts working-directory: ./artifacts
run: mv Bitwarden-${{ env.PKG_VERSION }}-universal.pkg Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive run: mv Bitwarden-${{ env.PKG_VERSION }}-universal.pkg Bitwarden-${{ env.PKG_VERSION }}-universal.pkg.archive
@ -111,7 +97,7 @@ jobs:
- name: Create release - name: Create release
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5 uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5
env: env:
PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }} PKG_VERSION: ${{ steps.version.outputs.version }}
with: with:
artifacts: "artifacts/Bitwarden-${{ env.PKG_VERSION }}-amd64.deb, artifacts: "artifacts/Bitwarden-${{ env.PKG_VERSION }}-amd64.deb,
artifacts/Bitwarden-${{ env.PKG_VERSION }}-x86_64.rpm, artifacts/Bitwarden-${{ env.PKG_VERSION }}-x86_64.rpm,
@ -146,7 +132,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: setup needs: setup
env: env:
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} _PKG_VERSION: ${{ needs.setup.outputs.release-version }}
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
@ -194,7 +180,7 @@ jobs:
runs-on: windows-2019 runs-on: windows-2019
needs: setup needs: setup
env: env:
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} _PKG_VERSION: ${{ needs.setup.outputs.release-version }}
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4