fix/added tests to cover db lookup for session refresh tokens #40
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: Publish Container | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| image_name: | |
| description: "Optional image name override" | |
| required: false | |
| type: string | |
| publish_latest: | |
| description: "Also publish the latest tag" | |
| required: false | |
| default: false | |
| type: boolean | |
| concurrency: | |
| group: ghcr-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Check Dockerfile availability | |
| id: dockerfile | |
| shell: bash | |
| run: | | |
| if [ -s docker/Dockerfile ]; then | |
| echo "ready=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "::warning::docker/Dockerfile is empty. Skipping image build." | |
| echo "ready=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Derive image reference | |
| if: steps.dockerfile.outputs.ready == 'true' | |
| id: image | |
| shell: bash | |
| run: | | |
| OWNER="$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" | |
| IMAGE_NAME="${{ github.event.inputs.image_name }}" | |
| if [ -z "$IMAGE_NAME" ]; then | |
| IMAGE_NAME="auth-service" | |
| fi | |
| IMAGE_NAME="$(echo "$IMAGE_NAME" | tr '[:upper:]' '[:lower:]')" | |
| echo "value=${{ env.REGISTRY }}/${OWNER}/${IMAGE_NAME}" >> "$GITHUB_OUTPUT" | |
| - name: Set up QEMU | |
| if: steps.dockerfile.outputs.ready == 'true' | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Set up Docker Buildx | |
| if: steps.dockerfile.outputs.ready == 'true' | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Log in to GHCR | |
| if: steps.dockerfile.outputs.ready == 'true' | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| if: steps.dockerfile.outputs.ready == 'true' | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ steps.image.outputs.value }} | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=tag | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=sha,format=short,prefix=sha- | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=raw,value=latest,enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.publish_latest == 'true' }} | |
| - name: Build and push image | |
| if: steps.dockerfile.outputs.ready == 'true' | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: docker/Dockerfile | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |