|
| 1 | +name: Scheduler docker image |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + tags: |
| 8 | + - '[0-9]+.[0-9]+.[0-9]+' |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + release: |
| 17 | + name: Build & push scheduler image to Dockerhub |
| 18 | + runs-on: ubuntu-latest |
| 19 | + if: github.repository == 'MobileTeleSystems/syncmaster' # prevent running on forks |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Set up QEMU |
| 23 | + uses: docker/setup-qemu-action@v3 |
| 24 | + |
| 25 | + - name: Set up Docker Buildx |
| 26 | + uses: docker/setup-buildx-action@v3 |
| 27 | + |
| 28 | + - name: Login to Docker Hub |
| 29 | + uses: docker/login-action@v3 |
| 30 | + with: |
| 31 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 32 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 33 | + |
| 34 | + - name: Checkout code |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Set tag |
| 38 | + id: set_tag |
| 39 | + run: | |
| 40 | + if [[ "${{ github.ref_type }}" == "branch" && "${{ github.ref_name }}" == "develop" ]]; then |
| 41 | + echo "TAG=mtsrus/syncmaster-scheduler:develop" >> $GITHUB_ENV |
| 42 | + elif [[ "${{ github.ref_type }}" == "tag" ]]; then |
| 43 | + echo "TAG=mtsrus/syncmaster-scheduler:latest,mtsrus/syncmaster-scheduler:${{ github.ref_name }}" >> $GITHUB_ENV |
| 44 | + fi |
| 45 | +
|
| 46 | + - name: Build scheduler image |
| 47 | + uses: docker/build-push-action@v6 |
| 48 | + with: |
| 49 | + tags: ${{ env.TAG }} |
| 50 | + context: . |
| 51 | + target: prod |
| 52 | + file: docker/Dockerfile.scheduler |
| 53 | + pull: true |
| 54 | + push: true |
| 55 | + cache-to: type=inline |
| 56 | + cache-from: mtsrus/syncmaster-scheduler:develop |
| 57 | + platforms: | |
| 58 | + linux/amd64 |
| 59 | + linux/arm64/v8 |
| 60 | + provenance: mode=max |
| 61 | + |
| 62 | + - name: Convert README to Markdown |
| 63 | + uses: docker://pandoc/core:2.9 |
| 64 | + with: |
| 65 | + args: >- |
| 66 | + --output=README.md |
| 67 | + --from=rst |
| 68 | + --to=gfm |
| 69 | + --wrap=none |
| 70 | + README.rst |
| 71 | +
|
| 72 | + - name: Update DockerHub Description |
| 73 | + uses: peter-evans/dockerhub-description@v4 |
| 74 | + if: github.ref_type == 'tag' |
| 75 | + with: |
| 76 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 77 | + # this requires token with read+write+delete permissions. read+write is not enough! |
| 78 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 79 | + repository: mtsrus/syncmaster-scheduler |
| 80 | + short-description: ${{ github.event.repository.description }} |
| 81 | + enable-url-completion: true |
0 commit comments