chore(github): update docker push process
This commit is contained in:
parent
382835e748
commit
0d8cc8f549
2 changed files with 54 additions and 39 deletions
39
.github/workflows/publish-docker-images.yml
vendored
39
.github/workflows/publish-docker-images.yml
vendored
|
@ -1,39 +0,0 @@
|
|||
name: Publish Docker Images
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
release:
|
||||
types: [ published ]
|
||||
jobs:
|
||||
push_to_registries:
|
||||
name: Push Docker images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: crazy-max/ghaction-docker-buildx@v3
|
||||
- name: Prepare
|
||||
id: prepare
|
||||
run: |
|
||||
DOCKER_IMAGE=garethflowers/ftp-server
|
||||
DOCKER_PLATFORMS=linux/386,linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/ppc64le,linux/s390x
|
||||
VERSION=latest
|
||||
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
VERSION=${GITHUB_REF#refs/tags/}
|
||||
fi
|
||||
|
||||
TAGS="--tag ${DOCKER_IMAGE}:${VERSION}"
|
||||
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
|
||||
TAGS="$TAGS --tag ${DOCKER_IMAGE}:latest"
|
||||
fi
|
||||
|
||||
echo ::set-output name=buildx_args::${TAGS} --platform ${DOCKER_PLATFORMS} .
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Push to Docker Hub
|
||||
run: docker buildx build --output "type=image,push=true" ${{ steps.prepare.outputs.buildx_args }}
|
54
.github/workflows/publish.yml
vendored
Normal file
54
.github/workflows/publish.yml
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
name: Publish
|
||||
on:
|
||||
push:
|
||||
branches: main
|
||||
tags:
|
||||
- "*.*.*"
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Prepare
|
||||
id: prep
|
||||
uses: crazy-max/ghaction-docker-meta@v2
|
||||
with:
|
||||
images: |
|
||||
${{ github.repository_owner }}/ftp-server
|
||||
ghcr.io/${{ github.repository_owner }}/ftp-server
|
||||
tags: |
|
||||
type=edge,branch=main
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=semver,pattern={{major}}
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Build and Push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x
|
||||
push: true
|
||||
tags: ${{ steps.prep.outputs.tags }}
|
||||
labels: ${{ steps.prep.outputs.labels }}
|
||||
- name: Update Description
|
||||
continue-on-error: true
|
||||
uses: peter-evans/dockerhub-description@v2
|
||||
with:
|
||||
short-description: ${{ github.event.repository.description }}
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
Loading…
Reference in a new issue