Browse Source

BRE-130 Release Notes for self-host are automatically generate by GitHub Workflow (#321)

* BRE-130 Release Notes for self-host are automatically generate by GitHub Workflow

* Generate release notes based on latest released versions
pull/322/head
Michał Chęciński 1 year ago committed by GitHub
parent
commit
e9610b42dd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 52
      .github/workflows/release.yml

52
.github/workflows/release.yml

@ -26,6 +26,8 @@ jobs: @@ -26,6 +26,8 @@ jobs:
outputs:
_WEB_RELEASE_TAG: ${{ steps.set-tags.outputs.WEB_RELEASE_TAG }}
_CORE_RELEASE_TAG: ${{ steps.set-tags.outputs.CORE_RELEASE_TAG }}
_KEY_CONNECTOR_RELEASE_TAG: ${{ steps.set-tags.outputs.KEY_CONNECTOR_RELEASE_TAG }}
_LATEST_SELF_HOST_VERSION: ${{ steps.get-self-host.outputs.version }}
steps:
- name: Branch check
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
@ -61,9 +63,11 @@ jobs: @@ -61,9 +63,11 @@ jobs:
run: |
WEB=$(jq -r '.versions.webVersion' < version.json)
CORE=$(jq -r '.versions.coreVersion' < version.json)
KEY_CONNECTOR=$(jq -r '.versions.keyConnectorVersion' < version.json)
echo "WEB_RELEASE_TAG=$WEB" >> $GITHUB_OUTPUT
echo "CORE_RELEASE_TAG=$CORE" >> $GITHUB_OUTPUT
echo "KEY_CONNECTOR_RELEASE_TAG=$KEY_CONNECTOR" >> $GITHUB_OUTPUT
release:
name: Create GitHub Release
@ -75,6 +79,50 @@ jobs: @@ -75,6 +79,50 @@ jobs:
with:
ref: main
- name: Get projects that changed versions
id: changed-projects
env:
_LATEST_SELF_HOST_VERSION: ${{ needs.setup.outputs._LATEST_SELF_HOST_VERSION }}
run: |
git diff --unified=0 v$_LATEST_SELF_HOST_VERSION main -- version.json >> diff.txt
if grep -q "webVersion" diff.txt; then
echo "WEB_VERSION_CHANGED=true" >> $GITHUB_OUTPUT
fi
if grep -q "coreVersion" diff.txt; then
echo "CORE_VERSION_CHANGED=true" >> $GITHUB_OUTPUT
fi
if grep -q "keyConnectorVersion" diff.txt; then
echo "KEY_CONNECTOR_VERSION_CHANGED=true" >> $GITHUB_OUTPUT
fi
- name: Prepare release notes
id: prepare-release-notes
run: |
RELEASE_NOTES=""
if [ -n "${{ steps.changed-projects.outputs.CORE_VERSION_CHANGED }}" ]; then
RELEASE_NOTES+="Update Core version to [v${{ needs.setup.outputs._CORE_RELEASE_TAG }}](https://github.com/bitwarden/server/releases/tag/v${{ needs.setup.outputs._CORE_RELEASE_TAG }})"
fi
if [ -n "${{ steps.changed-projects.outputs.WEB_VERSION_CHANGED }}" ]; then
if [ -n "$RELEASE_NOTES" ]; then
RELEASE_NOTES+="\n"
fi
RELEASE_NOTES+="Update Web version to [v${{ needs.setup.outputs._WEB_RELEASE_TAG }}](https://github.com/bitwarden/clients/releases/tag/web-v${{ needs.setup.outputs._WEB_RELEASE_TAG }})"
fi
if [ -n "${{ steps.changed-projects.outputs.KEY_CONNECTOR_VERSION_CHANGED }}" ]; then
if [ -n "$RELEASE_NOTES" ]; then
RELEASE_NOTES+="\n"
fi
RELEASE_NOTES+="Update Key Connector version to [v${{ needs.setup.outputs._KEY_CONNECTOR_RELEASE_TAG }}](https://github.com/bitwarden/key-connector/releases/tag/v${{ needs.setup.outputs._KEY_CONNECTOR_RELEASE_TAG }})"
fi
echo "RELEASE_NOTES=$RELEASE_NOTES" >> $GITHUB_OUTPUT
- name: Create release
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
@ -87,9 +135,9 @@ jobs: @@ -87,9 +135,9 @@ jobs:
commit: ${{ github.sha }}
tag: "v${{ github.event.inputs.release_version }}"
name: "Version ${{ github.event.inputs.release_version }}"
body: "<insert release notes here>"
body: ${{ steps.prepare-release-notes.outputs.RELEASE_NOTES }}
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
draft: false
release-version:
name: Upload version.json

Loading…
Cancel
Save