Skip to content

Commit

Permalink
Apply Docker image tag fix (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgrassia authored Aug 27, 2024
1 parent 00c9503 commit 9fcfd20
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 20 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Build

on:
Expand Down
33 changes: 14 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
name: Release
run-name: Release ${{ github.event.inputs.release_type }}
run-name: Release ${{ inputs.release_type }}

on:
workflow_dispatch:
Expand All @@ -23,7 +24,7 @@ jobs:

steps:
- name: Check branch
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
if: ${{ inputs.release_type != 'Dry Run' }}
run: |
if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then
echo "==================================="
Expand All @@ -39,7 +40,7 @@ jobs:
id: version
uses: bitwarden/gh-actions/release-version-check@main
with:
release-type: ${{ github.event.inputs.release_type }}
release-type: ${{ inputs.release_type }}
project-type: dotnet
file: Directory.Build.props

Expand All @@ -51,7 +52,7 @@ jobs:
release-github:
name: Create GitHub Release
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
if: ${{ inputs.release_type != 'Dry Run' }}
runs-on: ubuntu-22.04
needs: setup
steps:
Expand All @@ -76,7 +77,7 @@ jobs:
_PROJECT_NAME: key-connector
_RELEASE_VERSION: ${{ needs.setup.outputs.release_version }}
_BRANCH_NAME: ${{ needs.setup.outputs.branch-name }}
_RELEASE_OPTION: ${{ github.event.inputs.release_type }}
_RELEASE_OPTION: ${{ inputs.release_type }}

steps:
- name: Log in to Azure
Expand All @@ -95,33 +96,28 @@ jobs:
azure-keyvault-name: "bitwarden-ci"

- name: Pull image
run: |
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
docker pull $_AZ_REGISTRY/$_PROJECT_NAME:dev
else
docker pull $_AZ_REGISTRY/$_PROJECT_NAME:$_BRANCH_NAME
fi
run: docker pull $_AZ_REGISTRY/$_PROJECT_NAME:dev

- name: Tag version and latest
run: |
if [[ "${{ github.event.inputs.release_type }}" == "Dry Run" ]]; then
if [[ "${{ inputs.release_type }}" == "Dry Run" ]]; then
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:dev bitwarden/$_PROJECT_NAME:dryrun
else
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:$_BRANCH_NAME $_AZ_REGISTRY/$_PROJECT_NAME:$_RELEASE_VERSION
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:$_BRANCH_NAME $_AZ_REGISTRY/$_PROJECT_NAME:latest
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:dev $_AZ_REGISTRY/$_PROJECT_NAME:$_RELEASE_VERSION
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:dev $_AZ_REGISTRY/$_PROJECT_NAME:latest
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:$_BRANCH_NAME bitwarden/$_PROJECT_NAME:$_RELEASE_VERSION
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:$_BRANCH_NAME bitwarden/$_PROJECT_NAME:latest
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:dev bitwarden/$_PROJECT_NAME:$_RELEASE_VERSION
docker tag $_AZ_REGISTRY/$_PROJECT_NAME:dev bitwarden/$_PROJECT_NAME:latest
fi
- name: Push release version and latest image to ACR
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
if: ${{ inputs.release_type != 'Dry Run' }}
run: |
docker push $_AZ_REGISTRY/$_PROJECT_NAME:$_RELEASE_VERSION
docker push $_AZ_REGISTRY/$_PROJECT_NAME:latest
- name: Push release version and latest image to Docker Hub
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
if: ${{ inputs.release_type != 'Dry Run' }}
env:
DOCKER_CONTENT_TRUST: 1
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ steps.setup-dct.outputs.dct-delegate-repo-passphrase }}
Expand All @@ -140,7 +136,6 @@ jobs:
- release-docker
- release-github
- setup

steps:
- name: Check if any job failed
if: github.ref == 'refs/heads/main' && contains(needs.*.result, 'failure')
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/scan.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Scan

on:
Expand Down Expand Up @@ -71,7 +72,7 @@ jobs:

- name: Set up .NET
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1

- name: Install SonarCloud scanner
run: dotnet tool install dotnet-sonarscanner -g

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Testing

on:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Bump version

on:
Expand Down

0 comments on commit 9fcfd20

Please sign in to comment.