Support GitHub Container Registry
Adds support for GitHub Container Registry to CI/CD and simplifies with third-party Actions
This commit is contained in:
parent
2af9f19c3a
commit
f9ff57a26e
1 changed files with 28 additions and 37 deletions
65
.github/workflows/push-docker.yml
vendored
65
.github/workflows/push-docker.yml
vendored
|
@ -4,7 +4,6 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
- testGit
|
|
||||||
- main
|
- main
|
||||||
jobs:
|
jobs:
|
||||||
push:
|
push:
|
||||||
|
@ -37,43 +36,35 @@ jobs:
|
||||||
uses: docker/login-action@v2.1.0
|
uses: docker/login-action@v2.1.0
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_HUB_API }}
|
password: ${{ secrets.DOCKER_HUB_API }}
|
||||||
|
|
||||||
# - name: Check if tag exists
|
|
||||||
# id: checkIdExists
|
|
||||||
# continue-on-error: true
|
|
||||||
# run: |
|
|
||||||
# response=$(curl -s https://hub.docker.com/v2/repositories/frooodle/s-pdf/tags/?name=${{ steps.versionNumber.outputs.versionNumber }})
|
|
||||||
# result=$(echo $response | jq ".results")
|
|
||||||
# if [ "$result" == "[]" ]; then
|
|
||||||
# echo "Tag ${{ steps.versionNumber.outputs.versionNumber }} doesnt exist. Continuing with build and push."
|
|
||||||
# else
|
|
||||||
# echo "Tag ${{ steps.versionNumber.outputs.versionNumber }} already exists. Skipping build and push."
|
|
||||||
# exit 1;
|
|
||||||
# fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: Setup buildx
|
|
||||||
run: |
|
|
||||||
docker buildx create --name mybuilder
|
|
||||||
docker buildx use mybuilder
|
|
||||||
|
|
||||||
- name: Build and push versioned amd64 and v8
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
run: |
|
|
||||||
docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}-alpha" .
|
|
||||||
|
|
||||||
|
|
||||||
- name: Build and push versioned amd64 and v8
|
- name: Login to GitHub Container Registry
|
||||||
if: github.ref == 'refs/heads/master'
|
uses: docker/login-action@v2
|
||||||
run: |
|
with:
|
||||||
docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:${{ steps.versionNumber.outputs.versionNumber }}" .
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ github.token }}
|
||||||
|
|
||||||
|
- name: Generate tags
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
frooodle/s-pdf
|
||||||
|
ghcr.io/frooodle/s-pdf
|
||||||
|
tags: |
|
||||||
|
${{ steps.versionNumber.outputs.versionNumber }}${{ github.ref == 'refs/heads/main' && '-alpha' || '' }}
|
||||||
|
|
||||||
- name: Build and push latest amd64 and v8
|
- name: Set up QEMU
|
||||||
if: github.ref == 'refs/heads/master'
|
uses: docker/setup-qemu-action@v2
|
||||||
run: |
|
|
||||||
docker buildx build --platform="linux/amd64,linux/arm64/v8" --push --tag "frooodle/s-pdf:latest" .
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
platforms: linux/amd64,linux/arm64/v8
|
||||||
|
|
Loading…
Reference in a new issue