feat: new version of prividium #732
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and push Docker image | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "*" | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-push-image: | |
| name: Build and push Docker image | |
| runs-on: [matterlabs-ci-runner] | |
| # Only run docker build/push for the main repository, not forks | |
| # Allow manual dispatch from any repository | |
| if: github.repository == 'matter-labs/zksync-sso' | |
| steps: | |
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| submodules: recursive | |
| - name: Set git SHA | |
| id: git_sha | |
| run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| - name: Set Docker tag | |
| id: docker_tag | |
| run: | | |
| ts=$(date +%s%N | cut -b1-13) | |
| if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| echo "tag=${{ steps.git_sha.outputs.sha_short }}-${ts}" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.ref }}" == refs/tags/* ]]; then | |
| echo "tag=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT | |
| elif [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| echo "tag=none" >> $GITHUB_OUTPUT | |
| else | |
| echo "Unsupported event ${GITHUB_EVENT_NAME} or ref ${GITHUB_REF}, only refs/heads/, refs/tags/, pull_request, and workflow_dispatch are supported." | |
| exit 1 | |
| fi | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.0 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USER }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Login to GAR | |
| run: | | |
| gcloud auth configure-docker us-docker.pkg.dev -q | |
| - name: Build and push oidc-server image | |
| id: docker_build_oidc | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| target: oidc-server | |
| push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' }} | |
| tags: | | |
| matterlabs/sso-oidc-salt:${{ steps.docker_tag.outputs.tag }} | |
| matterlabs/sso-oidc-salt:latest | |
| us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/sso-oidc-salt:${{ steps.docker_tag.outputs.tag }} | |
| us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/sso-oidc-salt:latest | |
| - name: Build and push key-registry image | |
| id: docker_build_key_registry | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| target: key-registry | |
| push: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' }} | |
| tags: | | |
| matterlabs/sso-oidc-key-updater:${{ steps.docker_tag.outputs.tag }} | |
| matterlabs/sso-oidc-key-updater:latest | |
| us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/sso-oidc-key-updater:${{ steps.docker_tag.outputs.tag }} | |
| us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/sso-oidc-key-updater:latest | |
| - name: Print image digest to summary | |
| run: | | |
| echo "OIDC Server Image tag: ${{ steps.docker_tag.outputs.tag }}" >> $GITHUB_STEP_SUMMARY | |
| echo "Key Registry Image tag: ${{ steps.docker_tag.outputs.tag }}" >> $GITHUB_STEP_SUMMARY |