|
| 1 | +name: Build and Push outline-role-sync Image |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: [main] |
| 7 | + pull_request: |
| 8 | + branches: [main] |
| 9 | + release: |
| 10 | + types: [published] |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +permissions: {} |
| 17 | + |
| 18 | +jobs: |
| 19 | + pre-job: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + contents: read |
| 23 | + outputs: |
| 24 | + should_run: ${{ steps.check.outputs.should_run }} |
| 25 | + steps: |
| 26 | + - name: Check what should run |
| 27 | + id: check |
| 28 | + uses: immich-app/devtools/actions/pre-job@eed0f8b8165ffcb951f2ba854b2dd031935e1d73 # pre-job-action-v2.0.2 |
| 29 | + with: |
| 30 | + github-token: ${{ github.token }} |
| 31 | + force-events: 'workflow_dispatch,release' |
| 32 | + filters: | |
| 33 | + outline-role-sync: |
| 34 | + - 'services/outline-role-sync/**' |
| 35 | + - '.github/workflows/build-outline-role-sync.yml' |
| 36 | +
|
| 37 | + build_and_push: |
| 38 | + needs: [pre-job] |
| 39 | + permissions: |
| 40 | + packages: write |
| 41 | + if: ${{ fromJSON(needs.pre-job.outputs.should_run).outline-role-sync == true }} |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 47 | + with: |
| 48 | + persist-credentials: false |
| 49 | + |
| 50 | + - name: Login to GitHub Container Registry |
| 51 | + uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0 |
| 52 | + if: ${{ !github.event.pull_request.head.repo.fork }} |
| 53 | + with: |
| 54 | + registry: ghcr.io |
| 55 | + username: ${{ github.repository_owner }} |
| 56 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + |
| 58 | + - name: Generate docker image tags |
| 59 | + id: metadata |
| 60 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0 |
| 61 | + with: |
| 62 | + flavor: | |
| 63 | + # Disable latest tag |
| 64 | + latest=false |
| 65 | + images: | |
| 66 | + name=ghcr.io/${{ github.repository_owner }}/outline-role-sync |
| 67 | + tags: | |
| 68 | + type=ref,event=branch |
| 69 | + type=ref,event=pr |
| 70 | + type=semver,pattern=v{{version}} |
| 71 | + type=semver,pattern=v{{major}} |
| 72 | + type=raw,value=release,enable=${{ github.event_name == 'release' }} |
| 73 | +
|
| 74 | + - name: Build and push image |
| 75 | + uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 |
| 76 | + with: |
| 77 | + context: ./services/outline-role-sync |
| 78 | + platforms: linux/amd64 |
| 79 | + push: ${{ !github.event.pull_request.head.repo.fork && steps.metadata.outputs.tags != '' }} |
| 80 | + tags: ${{ steps.metadata.outputs.tags }} |
| 81 | + labels: ${{ steps.metadata.outputs.labels }} |
0 commit comments