Docker build and Publish #85
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: Docker build and Publish | |
| on: | |
| # allow manual triggers | |
| workflow_dispatch: | |
| # build every version tag | |
| push: | |
| tags: | |
| - v* | |
| env: | |
| DEBIAN_RELEASE: buster | |
| DOCKER_PWD: /root | |
| DOCKER_IMAGE: debian:${DEBIAN_RELEASE} | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build: | |
| name: Build Docker images | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| strategy: | |
| matrix: | |
| platform: | |
| - linux/amd64 | |
| - linux/arm64 | |
| steps: | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ github.repository }}/mattermost-enterprise-edition | |
| tags: | | |
| type=semver,pattern=v{{major}}.{{minor}}.{{patch}} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: "{{defaultContext}}:docker" | |
| platforms: ${{ matrix.platform }} | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| REPO_CLONE_TYPE=full | |
| MATTERMOST_IMAGE_TAG=${{ github.ref_name }} | |
| BUILD_NUMBER=${{ github.run_id }} | |
| outputs: root | |
| - name: Get platform name | |
| id: get-platform-name | |
| run: | | |
| PLATFORM=$(echo -n ${{ matrix.platform }} | sed 's|/|-|g') | |
| echo PLATFORM=$PLATFORM >> $GITHUB_OUTPUT | |
| - name: Compress binary artifact | |
| run: tar -C root -czf mattermost-enterprise-edition-${{ github.ref_name }}-${{ steps.get-platform-name.outputs.PLATFORM }}.tar.gz mattermost | |
| - name: Upload binary artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mattermost-enterprise-edition-${{ github.ref_name }}-${{ steps.get-platform-name.outputs.PLATFORM }}.tar.gz.zip | |
| path: mattermost-enterprise-edition-${{ github.ref_name }}-${{ steps.get-platform-name.outputs.PLATFORM }}.tar.gz | |
| compression-level: 0 | |
| release: | |
| name: Create a release | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get repository name | |
| id: repo-name | |
| run: echo -n ${{ github.repository }} | sed -E 's/(.*)\/(.*)/REPO_NAME=\2/' >> $GITHUB_OUTPUT | |
| - name: Download binary artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: mattermost-enterprise-edition-${{ github.ref_name }}-*.tar.gz.zip | |
| - name: Create Release | |
| id: create_release | |
| uses: ncipollo/release-action@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: Mattermost Enterprise Edition ${{ github.ref_name }} | |
| artifacts: mattermost-enterprise-edition-${{ github.ref_name }}-*.tar.gz.zip/mattermost-enterprise-edition-${{ github.ref_name }}-*.tar.gz | |
| body: "[Docker images](https://github.com/${{ github.repository }}/pkgs/container/${{ steps.repo-name.outputs.REPO_NAME }}%2Fmattermost-enterprise-edition)" | |
| - name: Delete temporary artifacts | |
| uses: geekyeggo/delete-artifact@v5 | |
| with: | |
| name: mattermost-enterprise-edition-${{ github.ref_name }}-*.tar.gz.zip |