Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish openresty Docker image | |
| on: | |
| release: | |
| types: | |
| - released | |
| - prereleased | |
| permissions: {} | |
| jobs: | |
| push_to_registry: | |
| name: Push Docker image to Docker Hub | |
| runs-on: ubuntu-latest | |
| environment: docker | |
| permissions: | |
| contents: read # checkout | |
| env: | |
| DOCKER_IMAGE: crowdsecurity/openresty | |
| steps: | |
| - name: Check out the repo | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Prepare | |
| id: prep | |
| env: | |
| VERSION: ${{ github.event.release.tag_name }} | |
| IS_LATEST: ${{ github.event.action == 'released' }} | |
| run: | | |
| set -euo pipefail | |
| TAGS="${DOCKER_IMAGE}:${VERSION}" | |
| if [[ "$IS_LATEST" == "true" ]]; then | |
| TAGS="${TAGS},${DOCKER_IMAGE}:latest" | |
| fi | |
| { | |
| echo "tags=${TAGS}" | |
| echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and push | |
| uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| tags: ${{ steps.prep.outputs.tags }} | |
| platforms: linux/amd64,linux/arm64 | |
| labels: | | |
| org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.created=${{ steps.prep.outputs.created }} | |
| org.opencontainers.image.revision=${{ github.sha }} |