You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
164 lines
6.4 KiB
164 lines
6.4 KiB
--- |
|
name: Update Versions |
|
|
|
on: |
|
workflow_dispatch: |
|
inputs: {} |
|
|
|
jobs: |
|
setup: |
|
name: Setup |
|
if: github.ref_name == 'master' || github.ref_name == 'rc' || github.ref_name == 'hotfix' |
|
runs-on: ubuntu-20.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@ec3a7ce113134d7a93b817d10a8272cb61118579 |
|
|
|
- name: Get Latest Core Version |
|
id: get-core |
|
uses: bitwarden/gh-actions/get-release-version@664c8899c95490c65dac0df11519d24ed8419c85 |
|
with: |
|
repository: bitwarden/server |
|
|
|
- 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 "::set-output name=update::1" |
|
else |
|
echo "::set-output name=update::0" |
|
fi |
|
|
|
- name: Get Latest Web Version |
|
id: get-web |
|
uses: bitwarden/gh-actions/get-release-version@664c8899c95490c65dac0df11519d24ed8419c85 |
|
with: |
|
repository: bitwarden/web |
|
|
|
- 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 "::set-output name=update::1" |
|
else |
|
echo "::set-output name=update::0" |
|
fi |
|
|
|
- name: Get Latest Key Connector Version |
|
id: get-key-connector |
|
uses: bitwarden/gh-actions/get-release-version@664c8899c95490c65dac0df11519d24ed8419c85 |
|
with: |
|
repository: bitwarden/key-connector |
|
|
|
- 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 "::set-output name=update::1" |
|
else |
|
echo "::set-output name=update::0" |
|
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-20.04 |
|
needs: setup |
|
steps: |
|
- name: Checkout Branch |
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 |
|
|
|
- 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@ec3a7ce113134d7a93b817d10a8272cb61118579 |
|
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 config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
|
git config --local user.name "github-actions[bot]" |
|
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."
|
|
|