acme.sh/.github/workflows/dockerhub.yml

51 lines
1.4 KiB
YAML
Raw Normal View History

2020-05-01 15:44:56 +00:00
name: Build DockerHub
on:
push:
2020-08-21 08:54:24 +00:00
branches:
- master
- dev
- temp
tags:
- '*'
2020-05-01 15:44:56 +00:00
jobs:
build:
runs-on: ubuntu-latest
steps:
2020-07-23 12:53:53 +00:00
- name: checkout code
uses: actions/checkout@v2
- name: install buildx
id: buildx
2020-08-21 08:54:24 +00:00
uses: crazy-max/ghaction-docker-buildx@v3
2020-07-23 12:53:53 +00:00
with:
2020-08-21 08:54:24 +00:00
buildx-version: latest
qemu-version: latest
2020-07-23 12:53:53 +00:00
- name: login to docker hub
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
2020-08-21 08:54:24 +00:00
- name: build and push the image
run: |
2020-08-21 09:34:43 +00:00
DOCKER_IMAGE=ei99070/acme.sh
if [[ $GITHUB_REF == refs/tags/* ]]; then
BRANCH_TAG=${GITHUB_REF#refs/tags/}
AUTO_UPGRADE=1
fi
if [[ $GITHUB_REF == refs/heads/* ]]; then
BRANCH_TAG=${GITHUB_REF#refs/heads/}
if [[ $BRANCH_TAG == master ]]; then
BRANCH_TAG=latest
AUTO_UPGRADE=1
fi
fi
2020-08-21 08:54:24 +00:00
docker buildx build \
2020-08-21 09:34:43 +00:00
--tag ${DOCKER_IMAGE}:${BRANCH_TAG} \
--tag ${DOCKER_IMAGE}:${GITHUB_SHA} \
2020-08-21 08:54:24 +00:00
--output "type=image,push=true" \
--build-arg AUTO_UPGRADE=${AUTO_UPGRADE} \
--platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386 .