ci: generate requirements.txt file from synapse's poetry.lock for invite-checker and token-authenticator tests #629
Workflow file for this run
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
| # GitHub actions workflow to build and push base docker images for pull requests. | |
| name: Build Dev Docker Image on PR | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'Pull request number. Be sure to match it to the correct branch selected' | |
| required: true | |
| type: string | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| dev-build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| IMAGE_NAME: synapse | |
| REGISTRY_GHCR: ghcr.io | |
| REGISTRY_HARBOR: registry.famedly.net/docker-oss | |
| steps: | |
| - name: Validate pr_number_on_dispatch | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| if ! [[ "${{ github.event.inputs.pr_number }}" =~ ^[0-9]+$ ]]; then | |
| echo "Error: pr_number must be numeric." | |
| exit 1 | |
| fi | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Harbor | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY_HARBOR }} | |
| username: ${{ vars.REGISTRY_USER }} | |
| password: ${{ secrets.registry_password }} | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ${{ env.REGISTRY_GHCR }}/famedly/${{ env.IMAGE_NAME }} | |
| ${{ env.REGISTRY_HARBOR }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,enable=${{ github.event_name == 'workflow_dispatch' }},value=pr-${{ github.event.inputs.pr_number }} | |
| type=ref,enable=${{ github.event_name == 'pull_request' }},event=pr | |
| flavor: latest=false | |
| - name: Build and push Docker image (amd64 only) | |
| id: build | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| platforms: linux/amd64 | |
| file: docker/Dockerfile | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| sbom: true |