|
| 1 | +name: release-docker |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + |
| 15 | + docker: |
| 16 | + |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Set up QEMU |
| 21 | + uses: docker/setup-qemu-action@v3 |
| 22 | + |
| 23 | + - name: Set up Docker Buildx |
| 24 | + uses: docker/setup-buildx-action@v3 |
| 25 | + |
| 26 | + - name: Login to DockerHub |
| 27 | + if: github.event_name != 'pull_request' |
| 28 | + uses: docker/login-action@v3 |
| 29 | + with: |
| 30 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 31 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 32 | + |
| 33 | + - name: Check out the repo |
| 34 | + uses: actions/checkout@v4 |
| 35 | + |
| 36 | + - name: Extract metadata (tags, labels) for Docker Hub |
| 37 | + id: meta_dockerhub |
| 38 | + uses: docker/metadata-action@v5 |
| 39 | + with: |
| 40 | + images: "openml/php-rest-api" |
| 41 | + |
| 42 | + - name: Build and push |
| 43 | + id: docker_build |
| 44 | + uses: docker/build-push-action@v6 |
| 45 | + with: |
| 46 | + context: . |
| 47 | + file: docker/Dockerfile |
| 48 | + tags: "dev_${{ steps.meta_dockerhub.outputs.tags }}" |
| 49 | + labels: ${{ steps.meta_dockerhub.outputs.labels }} |
| 50 | + platforms: linux/amd64,linux/arm64 |
| 51 | + push: ${{ github.event_name == 'push' }} |
| 52 | + |
| 53 | + - name: Update repo description |
| 54 | + if: ${{ startsWith(github.ref, 'refs/tags/v') }} |
| 55 | + uses: peter-evans/dockerhub-description@v4 |
| 56 | + with: |
| 57 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 58 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 59 | + repository: openml/php-rest-api |
| 60 | + short-description: "PHP rest api for OpenML." |
| 61 | + readme-filepath: ./docker/README.md |
| 62 | + |
| 63 | + - name: Image digest |
| 64 | + run: echo ${{ steps.docker_build.outputs.digest }} |
0 commit comments