|
| 1 | +# This task does not run complement tests, see tests.yaml instead. |
| 2 | +# This task does not build docker images for synapse for use on docker hub, see docker.yaml instead |
| 3 | + |
| 4 | +name: Store complement-synapse image in ghcr.io |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [ "master" ] |
| 8 | + schedule: |
| 9 | + - cron: '0 5 * * *' |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + branch: |
| 13 | + required: true |
| 14 | + default: 'develop' |
| 15 | + type: choice |
| 16 | + options: |
| 17 | + - develop |
| 18 | + - master |
| 19 | + |
| 20 | +# Only run this action once per pull request/branch; restart if a new commit arrives. |
| 21 | +# C.f. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency |
| 22 | +# and https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + build: |
| 29 | + name: Build and push complement image |
| 30 | + runs-on: ubuntu-latest |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + packages: write |
| 34 | + steps: |
| 35 | + - name: Checkout specific branch (debug build) |
| 36 | + uses: actions/checkout@v3 |
| 37 | + if: 'github.event.type == "workflow_dispatch"' |
| 38 | + with: |
| 39 | + ref: ${{ inputs.branch }} |
| 40 | + - name: Checkout clean copy of develop (scheduled build) |
| 41 | + uses: actions/checkout@v3 |
| 42 | + if: 'github.event.type == "schedule"' |
| 43 | + with: |
| 44 | + ref: develop |
| 45 | + - name: Checkout clean copy of master (on-push) |
| 46 | + uses: actions/checkout@v3 |
| 47 | + if: 'github.event.type == "push"' |
| 48 | + with: |
| 49 | + ref: master |
| 50 | + - name: Login to registry |
| 51 | + uses: docker/login-action@v1 |
| 52 | + with: |
| 53 | + registry: ghcr.io |
| 54 | + username: ${{ github.actor }} |
| 55 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 56 | + - name: Work out labels for complement image |
| 57 | + id: meta |
| 58 | + uses: docker/metadata-action@v1 |
| 59 | + with: |
| 60 | + images: ghcr.io/${{ github.repository }}/complement-synapse |
| 61 | + - name: Build complement image |
| 62 | + run: scripts-dev/complement.sh --build-only |
| 63 | + - name: Tag and push generated image |
| 64 | + run: | |
| 65 | + for TAG in ${{ steps.meta.outputs.tags }}; do |
| 66 | + docker tag complement-synapse:latest $TAG |
| 67 | + docker push $TAG |
| 68 | + done |
0 commit comments