kopia lustrzana https://github.com/gaul/s3proxy
fix pushing images to docker.io
rodzic
ea9fb9fd30
commit
40bdb6c1f9
|
@ -6,34 +6,33 @@ on:
|
|||
pull_request:
|
||||
branches:
|
||||
- "*"
|
||||
|
||||
env:
|
||||
dockerhub_publish: ${{ secrets.DOCKER_PASS != '' }}
|
||||
|
||||
jobs:
|
||||
|
||||
meta:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
dockerhub-publish: ${{ steps.dockerhub-publish.outputs.defined }}
|
||||
registry: ghcr.io/${{ github.repository }}/container:${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
||||
container_tags: ${{ steps.docker_action_meta.outputs.tags }}
|
||||
container_labels: ${{ steps.docker_action_meta.outputs.labels }}
|
||||
container_buildtime: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.created'] }}
|
||||
container_version: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.version'] }}
|
||||
container_revision: ${{ fromJSON(steps.docker_action_meta.outputs.json).labels['org.opencontainers.image.revision'] }}
|
||||
container_base: ${{ fromJSON(steps.docker_action_meta.outputs.json).tags[0] }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: false
|
||||
persist-credentials: false
|
||||
- id: dockerhub-publish
|
||||
if: "${{ env.MY_KEY != '' }}"
|
||||
run: echo "::set-output name=defined::true"
|
||||
env:
|
||||
MY_KEY: ${{ secrets.DOCKER_PASS }}
|
||||
- name: Docker meta
|
||||
id: docker_action_meta
|
||||
uses: docker/metadata-action@v4.0.1
|
||||
with:
|
||||
images: ghcr.io/${{ github.repository }}/container
|
||||
images:
|
||||
name=ghcr.io/${{ github.repository }}/container
|
||||
name=andrewgaul/s3proxy,enable=${{ env.dockerhub_publish }}
|
||||
flavor: |
|
||||
latest=false
|
||||
tags: |
|
||||
|
@ -103,17 +102,17 @@ jobs:
|
|||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2.0.0
|
||||
if: github.event_name != 'pull_request' && needs.meta.outputs.dockerhub-publish == 'true'
|
||||
uses: docker/login-action@v3
|
||||
if: github.event_name != 'pull_request' && env.dockerhub_publish == 'true'
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASS }}
|
||||
|
||||
- name: Login to GHCR
|
||||
uses: docker/login-action@v2.0.0
|
||||
uses: docker/login-action@v3
|
||||
if: github.event_name != 'pull_request'
|
||||
with:
|
||||
registry: ghcr.io
|
||||
|
@ -121,26 +120,14 @@ jobs:
|
|||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ needs.meta.outputs.container_base }}
|
||||
tags: ${{ needs.meta.outputs.container_tags }}
|
||||
labels: ${{ needs.meta.outputs.container_labels }}
|
||||
build-args: |
|
||||
BUILDTIME=${{ needs.meta.outputs.container_buildtime }}
|
||||
VERSION=${{ needs.meta.outputs.container_version }}
|
||||
REVISION=${{ needs.meta.outputs.container_revision }}
|
||||
cache-from: type=registry,ref=${{ needs.meta.outputs.container_base }}
|
||||
cache-to: type=inline
|
||||
|
||||
- name: Publish to Docker
|
||||
if: github.event_name != 'pull_request' && needs.meta.outputs.dockerhub-publish == 'true'
|
||||
run: |
|
||||
curl -L https://github.com/regclient/regclient/releases/download/v0.3.5/regctl-linux-amd64 >/tmp/regctl
|
||||
chmod 755 /tmp/regctl
|
||||
for line in $CONTAINER_DEST_TAGS; do echo working on "$line"; /tmp/regctl image copy $SOURCE_CONTAINER $line; done
|
||||
env:
|
||||
SOURCE_CONTAINER: ${{ needs.meta.outputs.container_version }}
|
||||
CONTAINER_DEST_TAGS: ${{ needs.meta.outputs.container_tags }}
|
||||
|
|
Ładowanie…
Reference in New Issue