mirror of
https://github.com/bitwarden/server.git
synced 2026-06-02 09:46:05 -05:00
* temporary change to test bre-1670 * removing temporary change * replace pat token with built in github token * sign commits with bot token * replace pat token with app token * fix api signing of git commits
71 lines
2.3 KiB
YAML
71 lines
2.3 KiB
YAML
name: Cleanup RC Branch
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v**
|
|
|
|
jobs:
|
|
delete-rc:
|
|
name: Delete RC Branch
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
steps:
|
|
- name: Log in to Azure
|
|
uses: bitwarden/gh-actions/azure-login@main
|
|
with:
|
|
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
|
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
|
|
client_id: ${{ secrets.AZURE_CLIENT_ID }}
|
|
|
|
- name: Retrieve bot secrets
|
|
id: retrieve-secret
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
with:
|
|
keyvault: gh-org-bitwarden
|
|
secrets: "BW-GHAPP-ID,BW-GHAPP-KEY"
|
|
|
|
- name: Log out from Azure
|
|
uses: bitwarden/gh-actions/azure-logout@main
|
|
|
|
- name: Generate GH App token
|
|
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ steps.retrieve-secret.outputs.BW-GHAPP-ID }}
|
|
private-key: ${{ steps.retrieve-secret.outputs.BW-GHAPP-KEY }}
|
|
owner: ${{ github.repository_owner }}
|
|
|
|
- name: Checkout main
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
ref: main
|
|
token: ${{ steps.app-token.outputs.token }}
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
|
|
- name: Check if a RC branch exists
|
|
id: branch-check
|
|
run: |
|
|
hotfix_rc_branch_check=$(git ls-remote --heads origin hotfix-rc | wc -l)
|
|
rc_branch_check=$(git ls-remote --heads origin rc | wc -l)
|
|
|
|
if [[ "${hotfix_rc_branch_check}" -gt 0 ]]; then
|
|
echo "hotfix-rc branch exists." | tee -a "$GITHUB_STEP_SUMMARY"
|
|
echo "name=hotfix-rc" >> "$GITHUB_OUTPUT"
|
|
elif [[ "${rc_branch_check}" -gt 0 ]]; then
|
|
echo "rc branch exists." | tee -a "$GITHUB_STEP_SUMMARY"
|
|
echo "name=rc" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Delete RC branch
|
|
env:
|
|
BRANCH_NAME: ${{ steps.branch-check.outputs.name }}
|
|
run: |
|
|
if ! [[ -z "$BRANCH_NAME" ]]; then
|
|
git push --quiet origin --delete "$BRANCH_NAME"
|
|
echo "Deleted $BRANCH_NAME branch." | tee -a "$GITHUB_STEP_SUMMARY"
|
|
fi
|