Skip to content

Commit 4cc7f13

Browse files
committed
Push to ghcr.io
1 parent fc2d0d1 commit 4cc7f13

File tree

1 file changed

+62
-44
lines changed

1 file changed

+62
-44
lines changed

.github/workflows/release.yml

Lines changed: 62 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: release
22

33
on:
4-
push:
5-
branches:
6-
- release
4+
release:
5+
types:
6+
- published
77
schedule:
88
- cron: '45 5 * * *'
99

@@ -20,64 +20,82 @@ jobs:
2020
runs-on: ubuntu-latest
2121
name: Builds new NetBox Docker Images
2222
steps:
23-
- id: git-checkout
23+
-
2424
name: Checkout
2525
uses: actions/checkout@v2
26-
- id: docker-build
26+
-
27+
name: Get Version of NetBox Docker
28+
run: |
29+
echo "::set-output name=version::$(cat VERSION)"
30+
shell: bash
31+
-
32+
name: Set up QEMU
33+
uses: docker/setup-qemu-action@v1
34+
-
35+
id: buildx-setup
36+
name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@v1
38+
with:
39+
install: true
40+
-
41+
name: Available platforms
42+
run: echo ${{ steps.buildx-setup.outputs.platforms }}
43+
-
44+
id: docker-build
2745
name: Build the image with '${{ matrix.build_cmd }}'
2846
run: ${{ matrix.build_cmd }}
2947
env:
3048
GH_ACTION: enable
31-
- id: docker-test
49+
-
3250
name: Test the image
3351
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
3452
if: steps.docker-build.outputs.skipped != 'true'
35-
- id: registry-login
36-
name: Login to the Docker Registry
37-
run: |
38-
echo "::add-mask::$DOCKERHUB_USERNAME"
39-
echo "::add-mask::$DOCKERHUB_PASSWORD"
40-
docker login -u "$DOCKERHUB_USERNAME" --password "${DOCKERHUB_PASSWORD}" "${DOCKER_REGISTRY}"
41-
env:
42-
DOCKERHUB_USERNAME: ${{ secrets.dockerhub_username }}
43-
DOCKERHUB_PASSWORD: ${{ secrets.dockerhub_password }}
53+
54+
# docker.io
55+
-
56+
name: Login to docker.io
57+
uses: docker/login-action@v1
58+
with:
59+
registry: docker.io
60+
username: ${{ secrets.dockerhub_username }}
61+
password: ${{ secrets.dockerhub_password }}
4462
if: steps.docker-build.outputs.skipped != 'true'
45-
- id: registry-push
46-
name: Push the image
63+
-
64+
name: Push the image to docker.io
4765
run: ${{ matrix.build_cmd }} --push-only
4866
if: steps.docker-build.outputs.skipped != 'true'
49-
- id: registry-logout
50-
name: Logout of the Docker Registry
51-
run: docker logout "${DOCKER_REGISTRY}"
52-
if: steps.docker-build.outputs.skipped != 'true'
5367

54-
# Quay.io
55-
- id: quayio-docker-build
56-
name: Build the image with '${{ matrix.build_cmd }}'
57-
run: ${{ matrix.build_cmd }}
68+
# quay.io
69+
-
70+
name: Login to Quay.io
71+
uses: docker/login-action@v1
72+
with:
73+
registry: quay.io
74+
username: ${{ secrets.quayio_username }}
75+
password: ${{ secrets.quayio_password }}
76+
if: steps.docker-build.outputs.skipped != 'true'
77+
-
78+
name: Build and push the image with '${{ matrix.build_cmd }}'
79+
run: ${{ matrix.build_cmd }} --push
5880
env:
5981
DOCKER_REGISTRY: quay.io
6082
GH_ACTION: enable
61-
- id: quayio-registry-login
62-
name: Login to the Quay.io Registry
63-
run: |
64-
echo "::add-mask::$QUAYIO_USERNAME"
65-
echo "::add-mask::$QUAYIO_PASSWORD"
66-
docker login -u "$QUAYIO_USERNAME" --password "${QUAYIO_PASSWORD}" "${DOCKER_REGISTRY}"
67-
env:
68-
DOCKER_REGISTRY: quay.io
69-
QUAYIO_USERNAME: ${{ secrets.quayio_username }}
70-
QUAYIO_PASSWORD: ${{ secrets.quayio_password }}
7183
if: steps.docker-build.outputs.skipped != 'true'
72-
- id: quayio-registry-push
73-
name: Push the image
74-
run: ${{ matrix.build_cmd }} --push-only
75-
env:
76-
DOCKER_REGISTRY: quay.io
84+
85+
# ghcr.io
86+
-
87+
name: Login to GitHub Container Registry
88+
uses: docker/login-action@v1
89+
with:
90+
registry: ghcr.io
91+
username: ${{ github.repository_owner }}
92+
password: ${{ secrets.GITHUB_TOKEN }}
7793
if: steps.docker-build.outputs.skipped != 'true'
78-
- id: quayio-registry-logout
79-
name: Logout of the Docker Registry
80-
run: docker logout "${DOCKER_REGISTRY}"
94+
-
95+
name: Build and push the image with '${{ matrix.build_cmd }}'
96+
run: ${{ matrix.build_cmd }} --push
8197
env:
82-
DOCKER_REGISTRY: quay.io
98+
DOCKER_REGISTRY: ghcr.io
99+
DOCKER_ORG: netbox-community
100+
GH_ACTION: enable
83101
if: steps.docker-build.outputs.skipped != 'true'

0 commit comments

Comments
 (0)