|
|
|
@ -13,6 +13,9 @@ on: |
|
|
|
required: true |
|
|
|
required: true |
|
|
|
type: string |
|
|
|
type: string |
|
|
|
default: master |
|
|
|
default: master |
|
|
|
|
|
|
|
is_workflow_call: |
|
|
|
|
|
|
|
type: boolean |
|
|
|
|
|
|
|
default: true |
|
|
|
workflow_dispatch: |
|
|
|
workflow_dispatch: |
|
|
|
inputs: |
|
|
|
inputs: |
|
|
|
server_branch: |
|
|
|
server_branch: |
|
|
|
@ -31,7 +34,7 @@ jobs: |
|
|
|
runs-on: ubuntu-22.04 |
|
|
|
runs-on: ubuntu-22.04 |
|
|
|
steps: |
|
|
|
steps: |
|
|
|
- name: Checkout Repository - workflow_call |
|
|
|
- name: Checkout Repository - workflow_call |
|
|
|
if: ${{ github.event_name == 'workflow_call' }} |
|
|
|
if: ${{ inputs.is_workflow_call == true }} |
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
|
|
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 |
|
|
|
with: |
|
|
|
with: |
|
|
|
repository: bitwarden/self-host |
|
|
|
repository: bitwarden/self-host |
|
|
|
@ -53,9 +56,15 @@ jobs: |
|
|
|
SERVER_BRANCH: ${{ steps.server-branch-name.outputs.server_branch }} |
|
|
|
SERVER_BRANCH: ${{ steps.server-branch-name.outputs.server_branch }} |
|
|
|
id: publish-branch-check |
|
|
|
id: publish-branch-check |
|
|
|
run: | |
|
|
|
run: | |
|
|
|
|
|
|
|
if [[ "${{ inputs.is_workflow_call }}" == "true" ]]; then |
|
|
|
|
|
|
|
REF=master |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
REF=${GITHUB_REF#/refs/heads/} |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
IFS="," read -a publish_branches <<< $PUBLISH_BRANCHES |
|
|
|
IFS="," read -a publish_branches <<< $PUBLISH_BRANCHES |
|
|
|
|
|
|
|
|
|
|
|
if [[ " ${publish_branches[*]} " =~ " ${SERVER_BRANCH} " ]]; then |
|
|
|
if [[ "${publish_branches[*]}" =~ "${REF}" && "${publish_branches[*]}" =~ "${SERVER_BRANCH}" ]]; then |
|
|
|
echo "is_publish_branch=true" >> $GITHUB_ENV |
|
|
|
echo "is_publish_branch=true" >> $GITHUB_ENV |
|
|
|
else |
|
|
|
else |
|
|
|
echo "is_publish_branch=false" >> $GITHUB_ENV |
|
|
|
echo "is_publish_branch=false" >> $GITHUB_ENV |
|
|
|
@ -111,18 +120,19 @@ jobs: |
|
|
|
SERVER_BRANCH: ${{ steps.server-branch-name.outputs.server_branch }} |
|
|
|
SERVER_BRANCH: ${{ steps.server-branch-name.outputs.server_branch }} |
|
|
|
run: | |
|
|
|
run: | |
|
|
|
IMAGE_TAG=$(echo "${SERVER_BRANCH}" | sed "s#/#-#g") # slash safe branch name |
|
|
|
IMAGE_TAG=$(echo "${SERVER_BRANCH}" | sed "s#/#-#g") # slash safe branch name |
|
|
|
if [[ "$IMAGE_TAG" == "master" ]]; then |
|
|
|
if [[ "${IMAGE_TAG}" == "master" ]]; then |
|
|
|
IMAGE_TAG=dev |
|
|
|
IMAGE_TAG=dev |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT |
|
|
|
echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT |
|
|
|
|
|
|
|
|
|
|
|
- name: Generate tag list |
|
|
|
- name: Generate tag list |
|
|
|
id: tag-list |
|
|
|
id: tag-list |
|
|
|
env: |
|
|
|
env: |
|
|
|
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} |
|
|
|
IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} |
|
|
|
|
|
|
|
IS_PUBLISH_BRANCH: ${{ env.is_publish_branch }} |
|
|
|
run: | |
|
|
|
run: | |
|
|
|
if [ "$IMAGE_TAG" = "dev" ] || [ "$IMAGE_TAG" = "beta" ]; then |
|
|
|
if [[ ("${IMAGE_TAG}" == "dev" || "${IMAGE_TAG}" == "beta") && "${IS_PUBLISH_BRANCH}" == "true" ]]; then |
|
|
|
echo "tags=bitwardenqa.azurecr.io/self-host:${IMAGE_TAG},bitwardenprod.azurecr.io/self-host:${IMAGE_TAG},bitwarden/self-host:${IMAGE_TAG}" >> $GITHUB_OUTPUT |
|
|
|
echo "tags=bitwardenqa.azurecr.io/self-host:${IMAGE_TAG},bitwardenprod.azurecr.io/self-host:${IMAGE_TAG},bitwarden/self-host:${IMAGE_TAG}" >> $GITHUB_OUTPUT |
|
|
|
else |
|
|
|
else |
|
|
|
echo "tags=bitwardenqa.azurecr.io/self-host:${IMAGE_TAG},bitwardenprod.azurecr.io/self-host:${IMAGE_TAG}" >> $GITHUB_OUTPUT |
|
|
|
echo "tags=bitwardenqa.azurecr.io/self-host:${IMAGE_TAG},bitwardenprod.azurecr.io/self-host:${IMAGE_TAG}" >> $GITHUB_OUTPUT |
|
|
|
|