Skip to content

Update README.md

Update README.md #113

Workflow file for this run

name: Docker
on: [push, pull_request]
# push:
# branches:
# - master
# - 'v[0-9]+*'
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Build Image
run: ./script/build.sh latest
publish:
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/v'))
name: Publish
needs: [ build ]
runs-on: ubuntu-latest
steps:
-
name: Check Branch
id: check-branch
run: |
if [[ ${{ github.ref }} =~ ^refs/heads/(master|v[0-9]+\.[0-9]+.*)$ ]]; then
echo ::set-output name=match::true
fi # See: https://stackoverflow.com/a/58869470/1123955
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all
-
# https://github.com/docker/setup-buildx-action
name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
version: latest
-
name: Builder instance name
run: echo ${{ steps.buildx.outputs.name }}
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
-
name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKER_PERSONAL_ACCESS_TOKEN }} | docker login -u zixia --password-stdin
env:
DOCKER_PERSONAL_ACCESS_TOKEN: ${{ secrets.DOCKER_PERSONAL_ACCESS_TOKEN }}
-
name: Checkout
uses: actions/checkout@v2
-
name: Is A Publish Branch
if: steps.check-branch.outputs.match == 'true'
run: |
version=$(cat VERSION)
majorVer=$(echo "$version" | cut -d. -f1)
minorVer=$(echo "$version" | cut -d. -f2)
tag="${majorVer}.${minorVer}"
docker build \
--platform linux/386,linux/amd64,linux/arm/v7,linux/arm/v6,linux/arm64 \
--tag zixia/simple-mail-forwarder:"$tag" \
--tag zixia/simple-mail-forwarder:latest \
--push \
.
-
name: Is Not A Publish Branch
if: steps.check-branch.outputs.match != 'true'
run: echo 'Not A Publish Branch'