mirror of
https://github.com/bitwarden/server.git
synced 2025-04-05 21:18:13 -05:00
Add dry-run option for release workflow (#1880)
This commit is contained in:
parent
156e10da0e
commit
1d5c9a4f9a
34
.github/workflows/release.yml
vendored
34
.github/workflows/release.yml
vendored
@ -12,6 +12,7 @@ on:
|
|||||||
options:
|
options:
|
||||||
- Initial Release
|
- Initial Release
|
||||||
- Redeploy
|
- Redeploy
|
||||||
|
- Dry Run
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -23,6 +24,7 @@ jobs:
|
|||||||
branch-name: ${{ steps.branch.outputs.branch-name }}
|
branch-name: ${{ steps.branch.outputs.branch-name }}
|
||||||
steps:
|
steps:
|
||||||
- name: Branch check
|
- name: Branch check
|
||||||
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
run: |
|
run: |
|
||||||
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
|
||||||
echo "==================================="
|
echo "==================================="
|
||||||
@ -32,7 +34,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
||||||
|
|
||||||
- name: Check Release Version
|
- name: Check Release Version
|
||||||
id: version
|
id: version
|
||||||
@ -90,7 +92,7 @@ jobs:
|
|||||||
artifacts: ${{ matrix.name }}.zip
|
artifacts: ${{ matrix.name }}.zip
|
||||||
|
|
||||||
- name: Login to Azure
|
- name: Login to Azure
|
||||||
uses: Azure/login@77f1b2e3fb80c0e8645114159d17008b8a2e475a
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
||||||
|
|
||||||
@ -115,7 +117,7 @@ jobs:
|
|||||||
echo "::set-output name=publish-profile::$publish_profile"
|
echo "::set-output name=publish-profile::$publish_profile"
|
||||||
|
|
||||||
- name: Deploy App
|
- name: Deploy App
|
||||||
uses: azure/webapps-deploy@798e43877120eda6a2a690a4f212c545e586ae31
|
uses: azure/webapps-deploy@0b651ed7546ecfc75024011f76944cb9b381ef1e
|
||||||
with:
|
with:
|
||||||
app-name: ${{ steps.retrieve-secrets.outputs.webapp-name }}
|
app-name: ${{ steps.retrieve-secrets.outputs.webapp-name }}
|
||||||
publish-profile: ${{ steps.retrieve-secrets.outputs.publish-profile }}
|
publish-profile: ${{ steps.retrieve-secrets.outputs.publish-profile }}
|
||||||
@ -150,11 +152,14 @@ jobs:
|
|||||||
- service_name: Sso
|
- service_name: Sso
|
||||||
steps:
|
steps:
|
||||||
- name: Print environment
|
- name: Print environment
|
||||||
|
env:
|
||||||
|
RELEASE_OPTION: ${{ github.event.inputs.release_type }}
|
||||||
run: |
|
run: |
|
||||||
whoami
|
whoami
|
||||||
docker --version
|
docker --version
|
||||||
echo "GitHub ref: $GITHUB_REF"
|
echo "GitHub ref: $GITHUB_REF"
|
||||||
echo "GitHub event: $GITHUB_EVENT"
|
echo "GitHub event: $GITHUB_EVENT"
|
||||||
|
echo "Github Release Option: $RELEASE_OPTION"
|
||||||
|
|
||||||
- name: Setup DCT
|
- name: Setup DCT
|
||||||
id: setup-dct
|
id: setup-dct
|
||||||
@ -164,7 +169,7 @@ jobs:
|
|||||||
azure-keyvault-name: "bitwarden-prod-kv"
|
azure-keyvault-name: "bitwarden-prod-kv"
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
||||||
|
|
||||||
- name: Setup service name
|
- name: Setup service name
|
||||||
id: setup
|
id: setup
|
||||||
@ -177,19 +182,31 @@ jobs:
|
|||||||
- name: Pull latest selfhost image
|
- name: Pull latest selfhost image
|
||||||
env:
|
env:
|
||||||
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
||||||
run: docker pull bitwarden/$SERVICE_NAME:$_BRANCH_NAME
|
RELEASE_OPTION: ${{ github.event.inputs.release_type }}
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
||||||
|
docker pull bitwarden/$SERVICE_NAME:latest
|
||||||
|
else
|
||||||
|
docker pull bitwarden/$SERVICE_NAME:$_BRANCH_NAME
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Tag version and latest
|
- name: Tag version and latest
|
||||||
env:
|
env:
|
||||||
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
SERVICE_NAME: ${{ steps.setup.outputs.service_name }}
|
||||||
|
RELEASE_OPTION: ${{ github.event.inputs.release_type }}
|
||||||
run: |
|
run: |
|
||||||
docker tag bitwarden/$SERVICE_NAME:$_BRANCH_NAME bitwarden/$SERVICE_NAME:$_RELEASE_VERSION
|
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
|
||||||
docker tag bitwarden/$SERVICE_NAME:$_BRANCH_NAME bitwarden/$SERVICE_NAME:latest
|
docker tag bitwarden/$SERVICE_NAME:latest bitwarden/$SERVICE_NAME:dryrun
|
||||||
|
else
|
||||||
|
docker tag bitwarden/$SERVICE_NAME:$_BRANCH_NAME bitwarden/$SERVICE_NAME:$_RELEASE_VERSION
|
||||||
|
docker tag bitwarden/$SERVICE_NAME:$_BRANCH_NAME bitwarden/$SERVICE_NAME:latest
|
||||||
|
fi
|
||||||
|
|
||||||
- name: List Docker images
|
- name: List Docker images
|
||||||
run: docker images
|
run: docker images
|
||||||
|
|
||||||
- name: Push version and latest image
|
- name: Push version and latest image
|
||||||
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
env:
|
env:
|
||||||
DOCKER_CONTENT_TRUST: 1
|
DOCKER_CONTENT_TRUST: 1
|
||||||
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
|
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
|
||||||
@ -219,7 +236,8 @@ jobs:
|
|||||||
swagger.json"
|
swagger.json"
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
|
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01
|
||||||
with:
|
with:
|
||||||
artifacts: 'docker-stub.zip,
|
artifacts: 'docker-stub.zip,
|
||||||
swagger.json'
|
swagger.json'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user