mirror of
https://github.com/bokysan/docker-postfix.git
synced 2024-09-20 14:56:10 +08:00
Upd: Simplify GitHub actions.
This commit is contained in:
parent
4d0e7b9755
commit
5c9e076f0b
7
.github/dependabot.yml
vendored
Normal file
7
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
# Maintain dependencies for GitHub Actions
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
78
.github/workflows/master.yml
vendored
78
.github/workflows/master.yml
vendored
|
@ -8,17 +8,42 @@ jobs:
|
||||||
buildx:
|
buildx:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
|
- name: Checkout branch
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Get release version
|
- name: Get release version
|
||||||
|
id: version_number
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
|
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
|
||||||
|
echo "::set-output name=RELEASE_VERSION::${GITHUB_REF:10}"
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: ./unit-tests.sh
|
run: ./unit-tests.sh
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@master
|
uses: docker/setup-buildx-action@master
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
|
||||||
|
- name: Builder info
|
||||||
|
run: |
|
||||||
|
echo "Name: ${{ steps.buildx.outputs.name }}"
|
||||||
|
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
|
||||||
|
echo "Status: ${{ steps.buildx.outputs.status }}"
|
||||||
|
echo "Flags: ${{ steps.buildx.outputs.flags }}"
|
||||||
|
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
|
||||||
|
|
||||||
- name: Cache Docker layers
|
- name: Cache Docker layers
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
|
@ -29,6 +54,12 @@ jobs:
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-single-buildx-
|
${{ runner.os }}-single-buildx-
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: 'boky'
|
||||||
|
password: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
shell: bash
|
shell: bash
|
||||||
env: # Or as an environment variable
|
env: # Or as an environment variable
|
||||||
|
@ -49,19 +80,40 @@ jobs:
|
||||||
- name: Run HELM chart tests
|
- name: Run HELM chart tests
|
||||||
run: ./helm/tests.sh
|
run: ./helm/tests.sh
|
||||||
|
|
||||||
- name: Build Alpine master
|
- name: Build and push unmarked release
|
||||||
env:
|
uses: docker/build-push-action@v2
|
||||||
DOCKER_USERNAME: 'boky'
|
with:
|
||||||
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
|
context: .
|
||||||
PLATFORMS: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" # linux/s390x: "rsyslog (no such package)"
|
push: true
|
||||||
run: ./build.sh -t boky/postfix:latest --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache-new" --push
|
tags: boky/postfix:latest
|
||||||
|
platforms: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" # linux/s390x: "rsyslog (no such package)"
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache/alpine
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new/alpine
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=alpine:latest
|
||||||
|
|
||||||
- name: Build Ubuntu master
|
- name: Build and push Alpine
|
||||||
env:
|
uses: docker/build-push-action@v2
|
||||||
DOCKER_USERNAME: 'boky'
|
with:
|
||||||
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
|
context: .
|
||||||
PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
|
push: true
|
||||||
run: ./build.sh -t boky/postfix:ubuntu-latest --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache-new" --build-arg=BASE_IMAGE=ubuntu:focal --push
|
tags: boky/postfix:latest-alpine
|
||||||
|
platforms: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" # linux/s390x: "rsyslog (no such package)"
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache-new/alpine
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=alpine:latest
|
||||||
|
|
||||||
|
- name: Build and push Ubuntu
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: boky/postfix:latest-ubuntu
|
||||||
|
platforms: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache/ubuntu
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new/ubuntu
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=ubuntu:focal
|
||||||
|
|
||||||
- name: Move cache
|
- name: Move cache
|
||||||
run: |
|
run: |
|
||||||
|
|
92
.github/workflows/tags.yml
vendored
92
.github/workflows/tags.yml
vendored
|
@ -8,26 +8,42 @@ jobs:
|
||||||
buildx:
|
buildx:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout tag
|
- name: Checkout tag
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Checkout gh-pages
|
- name: Checkout gh-pages
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: "gh-pages"
|
ref: "gh-pages"
|
||||||
path: "gh-pages"
|
path: "gh-pages"
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
- name: Get the build version number
|
|
||||||
|
- name: Get release version
|
||||||
id: version_number
|
id: version_number
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
|
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
|
||||||
echo "::set-output name=RELEASE_VERSION::${GITHUB_REF:10}"
|
echo "::set-output name=RELEASE_VERSION::${GITHUB_REF:10}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@master
|
uses: docker/setup-buildx-action@master
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
|
||||||
|
- name: Builder info
|
||||||
|
run: |
|
||||||
|
echo "Name: ${{ steps.buildx.outputs.name }}"
|
||||||
|
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
|
||||||
|
echo "Status: ${{ steps.buildx.outputs.status }}"
|
||||||
|
echo "Flags: ${{ steps.buildx.outputs.flags }}"
|
||||||
|
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
|
||||||
|
|
||||||
- name: Cache Docker layers
|
- name: Cache Docker layers
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
|
@ -38,19 +54,66 @@ jobs:
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-single-buildx-
|
${{ runner.os }}-single-buildx-
|
||||||
|
|
||||||
- name: Build Alpine tag
|
- name: Login to DockerHub
|
||||||
env:
|
uses: docker/login-action@v1
|
||||||
DOCKER_USERNAME: 'boky'
|
with:
|
||||||
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
|
username: 'boky'
|
||||||
PLATFORMS: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le"
|
password: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
|
||||||
run: ./build.sh -t boky/postfix:$RELEASE_VERSION --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache-new" --push
|
|
||||||
|
|
||||||
- name: Build Ubuntu tag
|
|
||||||
env:
|
|
||||||
DOCKER_USERNAME: 'boky'
|
|
||||||
DOCKER_PASSWORD: '${{ secrets.DOCKER_ACCESS_TOKEN }}'
|
|
||||||
PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
|
|
||||||
run: ./build.sh -t boky/postfix:ubuntu-$RELEASE_VERSION --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache-new" --build-arg=BASE_IMAGE=ubuntu:focal --push
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- name: Build and push unmarked release
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: boky/postfix:$RELEASE_VERSION
|
||||||
|
platforms: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" # linux/s390x: "rsyslog (no such package)"
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache/alpine
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new/alpine
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=alpine:latest
|
||||||
|
|
||||||
|
- name: Build and push Alpine
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: boky/postfix:$RELEASE_VERSION-alpine
|
||||||
|
platforms: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le" # linux/s390x: "rsyslog (no such package)"
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache-new/alpine
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=alpine:latest
|
||||||
|
|
||||||
|
- name: Build and push Ubuntu
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: boky/postfix:$RELEASE_VERSION-ubuntu
|
||||||
|
platforms: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache/ubuntu
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache-new/ubuntu
|
||||||
|
build-args: |
|
||||||
|
BASE_IMAGE=ubuntu:focal
|
||||||
|
|
||||||
- name: Move cache
|
- name: Move cache
|
||||||
run: |
|
run: |
|
||||||
|
@ -68,10 +131,12 @@ jobs:
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
# TODO: Include the changelog in Chart.yml as annotations.artifacthub.io/changes
|
# TODO: Include the changelog in Chart.yml as annotations.artifacthub.io/changes
|
||||||
# See more here: https://artifacthub.io/docs/topics/annotations/helm/#supported-annotations
|
# See more here: https://artifacthub.io/docs/topics/annotations/helm/#supported-annotations
|
||||||
|
|
||||||
- name: Package helm chart
|
- name: Package helm chart
|
||||||
uses: WyriHaximus/github-action-helm3@v2
|
uses: WyriHaximus/github-action-helm3@v2
|
||||||
with:
|
with:
|
||||||
exec: helm package --app-version $RELEASE_VERSION --version $RELEASE_VERSION --destination ./gh-pages helm/mail
|
exec: helm package --app-version $RELEASE_VERSION --version $RELEASE_VERSION --destination ./gh-pages helm/mail
|
||||||
|
|
||||||
- name: Create helm chart index
|
- name: Create helm chart index
|
||||||
uses: WyriHaximus/github-action-helm3@v2
|
uses: WyriHaximus/github-action-helm3@v2
|
||||||
with:
|
with:
|
||||||
|
@ -82,6 +147,7 @@ jobs:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./gh-pages
|
publish_dir: ./gh-pages
|
||||||
tag_name: gh-pages-${{ steps.version_number.outputs.RELEASE_VERSION }}
|
tag_name: gh-pages-${{ steps.version_number.outputs.RELEASE_VERSION }}
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
|
|
Loading…
Reference in a new issue