1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

Update workflows (#1344)

This commit is contained in:
Vince Grassia 2021-12-16 11:46:26 -05:00 committed by GitHub
parent 97ca771a00
commit 6a1e683a93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 36 deletions

View File

@ -40,8 +40,7 @@ jobs:
- name: Get GitHub sha as version - name: Get GitHub sha as version
id: version id: version
run: | run: echo "::set-output name=value::${GITHUB_SHA:0:7}"
echo "::set-output name=value::${GITHUB_SHA:0:7}"
build-oss-selfhost: build-oss-selfhost:
@ -170,7 +169,7 @@ jobs:
echo "GitHub event: $GITHUB_EVENT" echo "GitHub event: $GITHUB_EVENT"
- name: Setup DCT - name: Setup DCT
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/release' if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix'
id: setup-dct id: setup-dct
uses: bitwarden/gh-actions/setup-docker-trust@a8c384a05a974c05c48374c818b004be221d43ff uses: bitwarden/gh-actions/setup-docker-trust@a8c384a05a974c05c48374c818b004be221d43ff
with: with:
@ -216,12 +215,12 @@ jobs:
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
run: docker tag bitwarden/web bitwarden/web:dev run: docker tag bitwarden/web bitwarden/web:dev
- name: Tag release branch - name: Tag hotfix branch
if: github.ref == 'refs/heads/release' if: github.ref == 'refs/heads/hotfix'
run: docker tag bitwarden/web bitwarden/web:latest run: docker tag bitwarden/web bitwarden/web:hotfix
- name: List Docker images - name: List Docker images
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/release' if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix'
run: docker images run: docker images
- name: Push rc image - name: Push rc image
@ -238,15 +237,15 @@ jobs:
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 }}
- name: Push latest image - name: Push hotfix image
if: github.ref == 'refs/heads/release' if: github.ref == 'refs/heads/hotfix'
run: docker push bitwarden/web:latest run: docker push bitwarden/web:hotfix
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 }}
- name: Log out of Docker - name: Log out of Docker
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/release' if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' || github.ref == 'refs/heads/hotfix'
run: docker logout run: docker logout
@ -310,21 +309,21 @@ jobs:
docker --version docker --version
docker build -t bitwardenqa.azurecr.io/web . docker build -t bitwardenqa.azurecr.io/web .
- name: Get image tag # - name: Get image tag
id: image-tag # id: image-tag
run: | # run: |
IMAGE_TAG=$(echo "$GITHUB_REF" | awk '{split($0, a, "/"); print a[3];}') # IMAGE_TAG=$(echo "$GITHUB_REF" | awk '{split($0, a, "/"); print a[3];}')
TAG_EXTENSION=${{ github.event.inputs.custom_tag_extension }} # TAG_EXTENSION=${{ github.event.inputs.custom_tag_extension }}
if [[ $TAG_EXTENSION ]]; then # if [[ $TAG_EXTENSION ]]; then
IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION # IMAGE_TAG=$IMAGE_TAG-$TAG_EXTENSION
fi # fi
echo "::set-output name=value::$IMAGE_TAG" # echo "::set-output name=value::$IMAGE_TAG"
- name: Tag image # - name: Tag image
env: # env:
IMAGE_TAG: ${{ steps.image-tag.outputs.value }} # IMAGE_TAG: ${{ steps.image-tag.outputs.value }}
run: docker tag bitwardenqa.azurecr.io/web "bitwardenqa.azurecr.io/web:$IMAGE_TAG" # run: docker tag bitwardenqa.azurecr.io/web "bitwardenqa.azurecr.io/web:$IMAGE_TAG"
- name: Tag dev - name: Tag dev
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'
@ -333,10 +332,10 @@ jobs:
- name: List Docker images - name: List Docker images
run: docker images run: docker images
- name: Push image # - name: Push image
env: # env:
IMAGE_TAG: ${{ steps.image-tag.outputs.value }} # IMAGE_TAG: ${{ steps.image-tag.outputs.value }}
run: docker push "bitwardenqa.azurecr.io/web:$IMAGE_TAG" # run: docker push "bitwardenqa.azurecr.io/web:$IMAGE_TAG"
- name: Push dev images - name: Push dev images
if: github.ref == 'refs/heads/master' if: github.ref == 'refs/heads/master'

View File

@ -54,6 +54,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: setup needs: setup
env: env:
_BRANCH_NAME: ${{ needs.setup.outputs.branch-name }}
_RELEASE_VERSION: ${{ needs.setup.outputs.release_version }} _RELEASE_VERSION: ${{ needs.setup.outputs.release_version }}
steps: steps:
- name: Print environment - name: Print environment
@ -73,22 +74,24 @@ jobs:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
- name: Pull latest selfhost Release image - name: Pull latest selfhost image
run: docker pull bitwarden/web:latest run: docker pull bitwarden/web:$_BRANCH_NAME
- name: Tag version - name: Tag version and latest
run: | run: |
docker tag bitwarden/web:latest bitwarden/web:$_RELEASE_VERSION docker tag bitwarden/web:$_BRANCH_NAME bitwarden/web:$_RELEASE_VERSION
docker tag bitwarden/web:$_BRANCH_NAME bitwarden/web:latest
- name: List Docker images - name: List Docker images
run: docker images run: docker images
- name: Push images - name: Push version and latest image
run: |
docker push bitwarden/web:$_RELEASE_VERSION
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 }}
run: |
docker push bitwarden/web:$_RELEASE_VERSION
docker push bitwarden/web:latest
- name: Log out of Docker - name: Log out of Docker
run: docker logout run: docker logout