netbox-docker/.github/workflows/release.yml

115 lines
3.7 KiB
YAML
Raw Normal View History

2020-01-23 09:35:30 +01:00
name: release
on:
2021-03-12 16:55:51 +01:00
release:
types:
- published
schedule:
- cron: '45 5 * * *'
jobs:
build:
strategy:
matrix:
build_cmd:
- ./build-latest.sh
- PRERELEASE=true ./build-latest.sh
- ./build.sh feature
- ./build.sh develop
2021-03-12 16:55:51 +01:00
platform:
- linux/amd64
- linux/arm64
fail-fast: false
runs-on: ubuntu-latest
name: Builds new NetBox Docker Images
steps:
2020-01-17 18:10:36 +01:00
- id: git-checkout
name: Checkout
uses: actions/checkout@v2
2021-03-14 17:11:45 +01:00
- id: get-version
name: Get Version of NetBox Docker
run: |
echo "::set-output name=version::$(cat VERSION)"
shell: bash
- id: setup-cache
name: NetBox Docker Buildx Cache
uses: actions/cache@v2
with:
path: |
.buildx-cache
2021-03-14 17:27:20 +01:00
key: ${{ steps.get-version.outputs.version }}-release-${{ matrix.platform }}-${{ hashFiles('Dockerfile','requirements-container.txt') }}
2021-03-14 17:11:45 +01:00
restore-keys: |
${{ steps.get-version.outputs.version }}-release-
${{ steps.get-version.outputs.version }}-
2021-03-12 16:55:51 +01:00
- id: qemu-setup
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
- id: buildx-platforms
name: Available platforms
run: echo ${{ steps.buildx-setup.outputs.platforms }}
2020-01-17 18:10:36 +01:00
- id: docker-build
name: Build the image with '${{ matrix.build_cmd }}'
run: ${{ matrix.build_cmd }}
env:
GH_ACTION: enable
2021-03-12 16:55:51 +01:00
BUILDX_BUILDER_NAME: ${{ steps.buildx-setup.outputs.name }}
2021-03-14 17:11:45 +01:00
BUILDX_PLATFORMS: ${{ matrix.platform }}
2020-01-17 18:10:36 +01:00
- id: docker-test
name: Test the image
run: IMAGE="${FINAL_DOCKER_TAG}" ./test.sh
2020-01-17 18:10:36 +01:00
if: steps.docker-build.outputs.skipped != 'true'
- id: registry-login
name: Login to the Docker Registry
run: |
echo "::add-mask::$DOCKERHUB_USERNAME"
echo "::add-mask::$DOCKERHUB_PASSWORD"
docker login -u "$DOCKERHUB_USERNAME" --password "${DOCKERHUB_PASSWORD}" "${DOCKER_REGISTRY}"
env:
DOCKERHUB_USERNAME: ${{ secrets.dockerhub_username }}
DOCKERHUB_PASSWORD: ${{ secrets.dockerhub_password }}
2020-01-17 18:10:36 +01:00
if: steps.docker-build.outputs.skipped != 'true'
- id: registry-push
name: Push the image
run: ${{ matrix.build_cmd }} --push-only
2020-01-17 18:10:36 +01:00
if: steps.docker-build.outputs.skipped != 'true'
- id: registry-logout
name: Logout of the Docker Registry
run: docker logout "${DOCKER_REGISTRY}"
2020-01-17 18:10:36 +01:00
if: steps.docker-build.outputs.skipped != 'true'
2020-12-15 00:28:43 +01:00
# Quay.io
- id: quayio-docker-build
name: Build the image with '${{ matrix.build_cmd }}'
run: ${{ matrix.build_cmd }}
env:
DOCKER_REGISTRY: quay.io
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'
- id: quayio-registry-push
name: Push the image
run: ${{ matrix.build_cmd }} --push-only
env:
DOCKER_REGISTRY: quay.io
if: steps.docker-build.outputs.skipped != 'true'
- id: quayio-registry-logout
name: Logout of the Docker Registry
run: docker logout "${DOCKER_REGISTRY}"
env:
DOCKER_REGISTRY: quay.io
if: steps.docker-build.outputs.skipped != 'true'