|
| 1 | +# Trigger this workflow only to manually create a Docker release; this should only be used |
| 2 | +# in extraordinary circumstances, as Docker releases are normally created automatically as |
| 3 | +# part of the automated release workflow. |
| 4 | + |
| 5 | +name: release-manual-docker |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + ref: |
| 10 | + default: '' |
| 11 | + description: 'Reference (tag / SHA):' |
| 12 | +env: |
| 13 | + REGISTRY: docker.io |
| 14 | + IMAGE_NAME: parseplatform/parse-server |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + runs-on: ubuntu-18.04 |
| 18 | + permissions: |
| 19 | + contents: read |
| 20 | + packages: write |
| 21 | + steps: |
| 22 | + - name: Determine branch name |
| 23 | + id: branch |
| 24 | + run: echo "::set-output name=branch_name::${GITHUB_REF#refs/*/}" |
| 25 | + - name: Checkout repository |
| 26 | + uses: actions/checkout@v2 |
| 27 | + with: |
| 28 | + ref: ${{ github.event.inputs.ref }} |
| 29 | + - name: Set up QEMU |
| 30 | + id: qemu |
| 31 | + uses: docker/setup-qemu-action@v1 |
| 32 | + - name: Set up Docker Buildx |
| 33 | + uses: docker/setup-buildx-action@v1 |
| 34 | + - name: Log into Docker Hub |
| 35 | + if: github.event_name != 'pull_request' |
| 36 | + uses: docker/login-action@v1 |
| 37 | + with: |
| 38 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 39 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 40 | + - name: Extract Docker metadata |
| 41 | + id: meta |
| 42 | + uses: docker/metadata-action@v3 |
| 43 | + with: |
| 44 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 45 | + flavor: | |
| 46 | + latest=${{ steps.branch.outputs.branch_name == 'master' && github.event.inputs.ref == '' }} |
| 47 | + tags: | |
| 48 | + type=semver,enable=true,pattern={{version}},value=${{ github.event.inputs.ref }} |
| 49 | + type=raw,enable=${{ github.event.inputs.ref == '' }},value=latest |
| 50 | + - name: Build and push Docker image |
| 51 | + uses: docker/build-push-action@v2 |
| 52 | + with: |
| 53 | + context: . |
| 54 | + platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8 |
| 55 | + push: ${{ github.event_name != 'pull_request' }} |
| 56 | + tags: ${{ steps.meta.outputs.tags }} |
| 57 | + labels: ${{ steps.meta.outputs.labels }} |
0 commit comments