diff --git a/.github/workflows/default_on_push.yml b/.github/workflows/default_on_push.yml index 17105042..67d92394 100644 --- a/.github/workflows/default_on_push.yml +++ b/.github/workflows/default_on_push.yml @@ -2,7 +2,11 @@ name: "Build, Test & Deploy" on: push: - branches: [ "master", "stable" ] + branches: + - master + - stable + tags: + - '*.*.*' jobs: build-and-test-image: @@ -52,14 +56,16 @@ jobs: submodules: recursive - name: Prepare tags id: prep - run: | - DOCKER_IMAGE=${{ secrets.DOCKER_REPOSITORY }} - VERSION=latest - [[ $GITHUB_REF == refs/tags/* ]] && VERSION=${GITHUB_REF#refs/tags/v} - [[ $GITHUB_REF == 'refs/heads/stable' ]] && VERSION=stable - TAGS="${DOCKER_IMAGE}:${VERSION}" - [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] && TAGS="$TAGS,${DOCKER_IMAGE}:latest" - echo ::set-output name=tags::${TAGS} + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: | + ${{ secrets.DOCKER_REPOSITORY }} + ${{ secrets.GHCR_REPOSITORY }} + tag-edge: true + tag-semver: | + {{major}} + {{major}}.{{minor}} + {{major}}.{{minor}}.{{patch}} - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx @@ -77,6 +83,12 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ secrets.GHCR_USERNAME }} + password: ${{ secrets.GHCR_PASSWORD }} - name: Build image locally uses: docker/build-push-action@v2 with: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2caba1ae..9d2c631c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -34,7 +34,7 @@ The development workflow is the following: 7. [Commit][commit] and [sign your commit][gpg], push and create a pull-request to merge into `master` 1. Pull requests are automatically tested against the CI and will be reviewed when tests pass 2. When your changes are validated, your branch is merged - 3. CI builds the new `:latest` image + 3. CI builds the new `:edge` image immediately and your changes will be includes in the next version release. ## Coding Style diff --git a/README.md b/README.md index 11fec3ed..4a07436f 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,21 @@ A fullstack but simple mail server (SMTP, IMAP, LDAP, Antispam, Antivirus, etc.) ## Usage +### Available image sources / tags + +The [CI/CD workflows](https://github.com/docker-mailserver/docker-mailserver/actions) automatically build, test and push new images to container registries. Currently, the following registries are supported: +- [DockerHub](https://hub.docker.com/repository/docker/mailserver/docker-mailserver) +- [GitHub Container Registry](https://github.com/orgs/docker-mailserver/packages?repo_name=docker-mailserver) + +All workflows are using the **tagging convention** listed below. It is subsequently applied to all images pushed to supported container registries: + +| Event | Ref | Commit SHA | Image Tags | +|--------------|-----------------------|------------|-------------------------------| +| `push` | `refs/heads/master` | `cf20257` | `edge` | +| `push` | `refs/heads/stable` | `cf20257` | `stable` | +| `push tag` | `refs/tags/1.2.3` | `ad132f5` | `1.2.3`, `1.2`, `1`, `latest` | +| `push tag` | `refs/tags/v1.2.3` | `ad132f5` | `1.2.3`, `1.2`, `1`, `latest` | + ### Get the tools Download the `docker-compose.yml`, `compose.env`, `mailserver.env` and the `setup.sh` files: