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
| # This action will push version-tagged and latest images to Docker Hub | |
| # This requires three secrets to be set, the first two should be stored in Organization | |
| # Secrets, the last is a per-repository secret. | |
| # DOCKER_HUB_USERNAME: The Docker Hub username | |
| # DOCKER_HUB_ACCESS_TOKEN: Instead of a password | |
| # DOCKER_REPO_NAME: The full image name as it appears on Docker Hub | |
| name: GitHub Release & Push to Docker Hub | |
| on: | |
| push: | |
| tags: ["v*"] | |
| jobs: | |
| Deploy: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Put new versions into environment variables | |
| run: | | |
| echo "WP_VERSION=$(jq -r '.wordpress' wp-version.json)" >> $GITHUB_ENV | |
| echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
| - name: Create GitHub release | |
| if: ${{ contains(github.ref, 'refs/tags/') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create ${{ github.ref_name }} --generate-notes | |
| # https://github.com/docker/setup-qemu-action | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| # https://github.com/docker/setup-buildx-action | |
| - name: Set up Docker Buildx | |
| id: buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Available platforms | |
| run: echo ${{ steps.buildx.outputs.platforms }} | |
| # https://github.com/docker/login-action | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| # https://github.com/docker/metadata-action | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ secrets.DOCKER_REPO_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=${{ env.WP_VERSION }}-${{ env.VERSION }} | |
| type=raw,value=${{ env.WP_VERSION }} | |
| type=sha | |
| # https://github.com/docker/build-push-action | |
| - name: Build and push to DockerHub | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| Update-Readme: | |
| runs-on: ubuntu-24.04 | |
| needs: Deploy # Run only if Deploy succeeds | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # https://github.com/marketplace/actions/docker-hub-description | |
| - name: Update Docker Hub Readme | |
| uses: peter-evans/dockerhub-description@v4 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
| repository: ${{ secrets.DOCKER_REPO_NAME }} |