|
| 1 | +name: Release to docker hub |
| 2 | + |
| 3 | +on: |
| 4 | + release: { types: [published] } |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + version: |
| 8 | + description: 'Version to simulate for deploy' |
| 9 | + required: true |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +jobs: |
| 15 | + dockerhub: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + packages: write |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 |
| 21 | + |
| 22 | + - id: version |
| 23 | + run: | |
| 24 | + EXPECTED_VERSION=${{ github.event.inputs.version }} |
| 25 | + TAG_VERSION=${GITHUB_REF#refs/tags/v} # refs/tags/v1.2.3 -> 1.2.3 |
| 26 | + echo ::set-output name=version::${EXPECTED_VERSION:-$TAG_VERSION} |
| 27 | + - name: Set up QEMU |
| 28 | + uses: docker/setup-qemu-action@2b82ce82d56a2a04d2637cd93a637ae1b359c0a7 # v2.2.0 |
| 29 | + |
| 30 | + |
| 31 | + - name: Login to DockerHub |
| 32 | + uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0 |
| 33 | + with: |
| 34 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 35 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 36 | + |
| 37 | + - name: Log in to the GitHub Container registry |
| 38 | + uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc |
| 39 | + with: |
| 40 | + registry: ghcr.io |
| 41 | + username: ${{ github.actor }} |
| 42 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 43 | + |
| 44 | + - name: Set up Docker Buildx |
| 45 | + id: buildx |
| 46 | + uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1 |
| 47 | + |
| 48 | + - uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 |
| 49 | + with: |
| 50 | + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 |
| 51 | + tags: ${{ secrets.DOCKER_USERNAME }}/bats:${{ steps.version.outputs.version }},${{ secrets.DOCKER_USERNAME }}/bats:latest |
| 52 | + push: true |
| 53 | + |
| 54 | + - uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1 |
| 55 | + with: |
| 56 | + platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 |
| 57 | + tags: ${{ secrets.DOCKER_USERNAME }}/bats:${{ steps.version.outputs.version }}-no-faccessat2,${{ secrets.DOCKER_USERNAME }}/bats:latest-no-faccessat2 |
| 58 | + push: true |
| 59 | + build-args: bashver=5.1.4 |
0 commit comments