mirror of
https://github.com/bitwarden/self-host.git
synced 2026-06-28 06:15:46 +00:00
193 lines
7.3 KiB
YAML
193 lines
7.3 KiB
YAML
---
|
|
name: Update Versions
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup
|
|
if: github.ref_name == 'main'
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
core_version: ${{ steps.get-core.outputs.version }}
|
|
core_version_update: ${{ steps.core-update.outputs.update }}
|
|
web_version: ${{ steps.get-web.outputs.version }}
|
|
web_version_update: ${{ steps.web-update.outputs.update }}
|
|
key_connector_version: ${{ steps.get-key-connector.outputs.version }}
|
|
key_connector_version_update: ${{ steps.key-connector-update.outputs.update }}
|
|
|
|
steps:
|
|
- name: Checkout Branch
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
|
|
- name: Get Latest Core Version
|
|
id: get-core
|
|
uses: bitwarden/gh-actions/get-release-version@main
|
|
with:
|
|
repository: bitwarden/server
|
|
trim: true
|
|
|
|
- name: Check if Core Version needs updating
|
|
id: core-update
|
|
env:
|
|
LATEST_CORE_VERSION: ${{ steps.get-core.outputs.version }}
|
|
run: |
|
|
CORE_VERSION=$(sed -r -n "s/COREVERSION=\"([0-9]+\.[0-9]+\.[0-9]+)\"/\1/p" bitwarden.sh)
|
|
echo "Core Version: $CORE_VERSION"
|
|
echo "Latest Core Version: $LATEST_CORE_VERSION"
|
|
if [ "$CORE_VERSION" != "$LATEST_CORE_VERSION" ]; then
|
|
echo "Needs Core update!"
|
|
echo "update=1" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "update=0" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Get Latest Web Version
|
|
id: get-web
|
|
uses: bitwarden/gh-actions/get-release-version@main
|
|
with:
|
|
repository: bitwarden/clients
|
|
monorepo: true
|
|
monorepo-project: web
|
|
trim: true
|
|
|
|
- name: Check if Web Version needs updating
|
|
id: web-update
|
|
env:
|
|
LATEST_WEB_VERSION: ${{ steps.get-web.outputs.version }}
|
|
run: |
|
|
WEB_VERSION=$(sed -r -n "s/WEBVERSION=\"([0-9]+\.[0-9]+\.[0-9]+)\"/\1/p" bitwarden.sh)
|
|
echo "Web Version: $WEB_VERSION"
|
|
echo "Latest Web Version: $LATEST_WEB_VERSION"
|
|
if [ "$WEB_VERSION" != "$LATEST_WEB_VERSION" ]; then
|
|
echo "Needs Web update!"
|
|
echo "update=1" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "update=0" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Get Latest Key Connector Version
|
|
id: get-key-connector
|
|
uses: bitwarden/gh-actions/get-release-version@main
|
|
with:
|
|
repository: bitwarden/key-connector
|
|
trim: true
|
|
|
|
- name: Check if Key Connector Version needs updating
|
|
id: key-connector-update
|
|
env:
|
|
LATEST_KEY_CONNECTOR_VERSION: ${{ steps.get-key-connector.outputs.version }}
|
|
run: |
|
|
KEY_CONNECTOR_VERSION=$(sed -r -n "s/KEYCONNECTORVERSION=\"([0-9]+\.[0-9]+\.[0-9]+)\"/\1/p" bitwarden.sh)
|
|
echo "Key Connector Version: $KEY_CONNECTOR_VERSION"
|
|
echo "Latest Key Connector Version: $LATEST_KEY_CONNECTOR_VERSION"
|
|
if [ "$KEY_CONNECTOR_VERSION" != "$LATEST_KEY_CONNECTOR_VERSION" ]; then
|
|
echo "Needs Key Connector update!"
|
|
echo "update=1" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "update=0" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
|
|
update-versions:
|
|
name: "Create update_versions branch"
|
|
if: |
|
|
needs.setup.outputs.core_version_update == 1 ||
|
|
needs.setup.outputs.web_version_update == 1 ||
|
|
needs.setup.outputs.key_connector_version_update == 1
|
|
runs-on: ubuntu-22.04
|
|
needs: setup
|
|
steps:
|
|
- name: Log in to Azure - CI subscription
|
|
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
|
with:
|
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
|
|
|
- name: Retrieve secrets
|
|
id: retrieve-secrets
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
with:
|
|
keyvault: "bitwarden-ci"
|
|
secrets: "github-gpg-private-key,
|
|
github-gpg-private-key-passphrase,
|
|
github-pat-bitwarden-devops-bot-repo-scope"
|
|
|
|
- name: Checkout Branch
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
|
|
- name: Import GPG key
|
|
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0
|
|
with:
|
|
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
|
|
passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
|
|
git_user_signingkey: true
|
|
git_commit_gpgsign: true
|
|
|
|
- name: Set up Git
|
|
run: |
|
|
git config --local user.email "106330231+bitwarden-devops-bot@users.noreply.github.com"
|
|
git config --local user.name "bitwarden-devops-bot"
|
|
|
|
- name: Create Update Versions Branch
|
|
run: |
|
|
git switch -c update-versions
|
|
git push -u origin update-versions
|
|
|
|
- name: Checkout Update Versions Branch
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
with:
|
|
ref: update-versions
|
|
|
|
- name: Update Core Version
|
|
env:
|
|
VERSION: ${{ needs.setup.outputs.core_version }}
|
|
run: |
|
|
sed -i -e "/^\s*COREVERSION\s*=\s*/s/[0-9]\+.[0-9]\+.[0-9]\+/$VERSION/" bitwarden.sh
|
|
sed -i -e "/^\s*\$coreVersion\s*=\s*/s/[0-9]\+.[0-9]\+.[0-9]\+/$VERSION/" bitwarden.ps1
|
|
sed -i -e '/"coreVersion":/ s/"coreVersion":[^,]*/"coreVersion":"'$VERSION'"/' version.json
|
|
|
|
- name: Update Web Version
|
|
env:
|
|
VERSION: ${{ needs.setup.outputs.web_version }}
|
|
run: |
|
|
sed -i -e "/^\s*WEBVERSION\s*=\s*/s/[0-9]\+.[0-9]\+.[0-9]\+/$VERSION/" bitwarden.sh
|
|
sed -i -e "/^\s*\$webVersion\s*=\s*/s/[0-9]\+.[0-9]\+.[0-9]\+/$VERSION/" bitwarden.ps1
|
|
sed -i -e '/"webVersion":/ s/"webVersion":[^,]*/"webVersion":"'$VERSION'"/' version.json
|
|
|
|
- name: Update Key Connector Version
|
|
env:
|
|
VERSION: ${{ needs.setup.outputs.key_connector_version }}
|
|
run: |
|
|
sed -i -e "/^\s*KEYCONNECTORVERSION\s*=\s*/s/[0-9]\+.[0-9]\+.[0-9]\+/$VERSION/" bitwarden.sh
|
|
sed -i -e "/^\s*\$keyConnectorVersion\s*=\s*/s/[0-9]\+.[0-9]\+.[0-9]\+/$VERSION/" bitwarden.ps1
|
|
sed -i -e '/"keyConnectorVersion":/ s/"keyConnectorVersion":[^,]*/"keyConnectorVersion":"'$VERSION'"/' version.json
|
|
|
|
- name: Commit updated files
|
|
run: git commit -m "Updated core, web, and key-connector versions" -a
|
|
|
|
- name: Push changes
|
|
run: git push -u origin update-versions
|
|
|
|
- name: Create Update Versions PR
|
|
env:
|
|
PR_BRANCH: "update-versions"
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
BASE_BRANCH: ${{ github.ref_name }}
|
|
TITLE: "Update core, web, and key-connector versions"
|
|
run: |
|
|
gh pr create --title "$TITLE" \
|
|
--base "$BASE_BRANCH" \
|
|
--head "$PR_BRANCH" \
|
|
--label "automated pr" \
|
|
--body "
|
|
## Type of change
|
|
- [ ] Bug fix
|
|
- [ ] New feature development
|
|
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
|
|
- [ ] Build/deploy pipeline (DevOps)
|
|
- [X] Other
|
|
|
|
## Objective
|
|
Automated version updates to core, web, and key-connector versions in version.json, bitwarden.sh and bitwarden.ps1."
|