Merge pull request #621 from cimnine/GHCR
Publish image to GitHub Container Registry
This commit is contained in:
commit
1e78ccd204
106
.github/workflows/release.yml
vendored
106
.github/workflows/release.yml
vendored
@ -1,9 +1,9 @@
|
|||||||
name: release
|
name: release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
branches:
|
types:
|
||||||
- release
|
- published
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '45 5 * * *'
|
- cron: '45 5 * * *'
|
||||||
|
|
||||||
@ -20,64 +20,82 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Builds new NetBox Docker Images
|
name: Builds new NetBox Docker Images
|
||||||
steps:
|
steps:
|
||||||
- id: git-checkout
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- id: docker-build
|
-
|
||||||
|
name: Get Version of NetBox Docker
|
||||||
|
run: |
|
||||||
|
echo "::set-output name=version::$(cat VERSION)"
|
||||||
|
shell: bash
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
id: buildx-setup
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
-
|
||||||
|
name: Available platforms
|
||||||
|
run: echo ${{ steps.buildx-setup.outputs.platforms }}
|
||||||
|
-
|
||||||
|
id: docker-build
|
||||||
name: Build the image with '${{ matrix.build_cmd }}'
|
name: Build the image with '${{ matrix.build_cmd }}'
|
||||||
run: ${{ matrix.build_cmd }}
|
run: ${{ matrix.build_cmd }}
|
||||||
env:
|
env:
|
||||||
GH_ACTION: enable
|
GH_ACTION: enable
|
||||||
- id: docker-test
|
-
|
||||||
name: Test the image
|
name: Test the image
|
||||||
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
|
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
- id: registry-login
|
|
||||||
name: Login to the Docker Registry
|
# docker.io
|
||||||
run: |
|
-
|
||||||
echo "::add-mask::$DOCKERHUB_USERNAME"
|
name: Login to docker.io
|
||||||
echo "::add-mask::$DOCKERHUB_PASSWORD"
|
uses: docker/login-action@v1
|
||||||
docker login -u "$DOCKERHUB_USERNAME" --password "${DOCKERHUB_PASSWORD}" "${DOCKER_REGISTRY}"
|
with:
|
||||||
env:
|
registry: docker.io
|
||||||
DOCKERHUB_USERNAME: ${{ secrets.dockerhub_username }}
|
username: ${{ secrets.dockerhub_username }}
|
||||||
DOCKERHUB_PASSWORD: ${{ secrets.dockerhub_password }}
|
password: ${{ secrets.dockerhub_password }}
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
- id: registry-push
|
-
|
||||||
name: Push the image
|
name: Push the image to docker.io
|
||||||
run: ${{ matrix.build_cmd }} --push-only
|
run: ${{ matrix.build_cmd }} --push-only
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
- id: registry-logout
|
|
||||||
name: Logout of the Docker Registry
|
|
||||||
run: docker logout "${DOCKER_REGISTRY}"
|
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
|
||||||
|
|
||||||
# Quay.io
|
# quay.io
|
||||||
- id: quayio-docker-build
|
-
|
||||||
name: Build the image with '${{ matrix.build_cmd }}'
|
name: Login to Quay.io
|
||||||
run: ${{ matrix.build_cmd }}
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: quay.io
|
||||||
|
username: ${{ secrets.quayio_username }}
|
||||||
|
password: ${{ secrets.quayio_password }}
|
||||||
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
|
-
|
||||||
|
name: Build and push the image with '${{ matrix.build_cmd }}'
|
||||||
|
run: ${{ matrix.build_cmd }} --push
|
||||||
env:
|
env:
|
||||||
DOCKER_REGISTRY: quay.io
|
DOCKER_REGISTRY: quay.io
|
||||||
GH_ACTION: enable
|
GH_ACTION: enable
|
||||||
- id: quayio-registry-login
|
|
||||||
name: Login to the Quay.io Registry
|
|
||||||
run: |
|
|
||||||
echo "::add-mask::$QUAYIO_USERNAME"
|
|
||||||
echo "::add-mask::$QUAYIO_PASSWORD"
|
|
||||||
docker login -u "$QUAYIO_USERNAME" --password "${QUAYIO_PASSWORD}" "${DOCKER_REGISTRY}"
|
|
||||||
env:
|
|
||||||
DOCKER_REGISTRY: quay.io
|
|
||||||
QUAYIO_USERNAME: ${{ secrets.quayio_username }}
|
|
||||||
QUAYIO_PASSWORD: ${{ secrets.quayio_password }}
|
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
- id: quayio-registry-push
|
|
||||||
name: Push the image
|
# ghcr.io
|
||||||
run: ${{ matrix.build_cmd }} --push-only
|
-
|
||||||
env:
|
name: Login to GitHub Container Registry
|
||||||
DOCKER_REGISTRY: quay.io
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
- id: quayio-registry-logout
|
-
|
||||||
name: Logout of the Docker Registry
|
name: Build and push the image with '${{ matrix.build_cmd }}'
|
||||||
run: docker logout "${DOCKER_REGISTRY}"
|
run: ${{ matrix.build_cmd }} --push
|
||||||
env:
|
env:
|
||||||
DOCKER_REGISTRY: quay.io
|
DOCKER_REGISTRY: ghcr.io
|
||||||
|
DOCKER_ORG: netbox-community
|
||||||
|
GH_ACTION: enable
|
||||||
if: steps.docker-build.outputs.skipped != 'true'
|
if: steps.docker-build.outputs.skipped != 'true'
|
||||||
|
Loading…
Reference in New Issue
Block a user