Skip to content

Add GH action

Add GH action #1

Workflow file for this run

name: netbox-init
on:
push:
workflow_dispatch:
schedule:
- cron: '15 12 * * 1'
env:
QUAY_IMAGE: quay.io/zebbra/netbox-init
CONTAINER_PLATFORMS: "linux/amd64,linux/arm64"
TAG: latest
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to quay.io Container Registry
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Generate image tag
id: tag
run: echo "tag=$(date +%Y%m%d%H%M)-${{ env.GITHUB_SHA_SHORT }}" >> "$GITHUB_OUTPUT"
- name: Build
run: >
docker buildx build --pull --push
-t ${{ env.QUAY_IMAGE }}:${{ env.TAG }}
-t ${{ env.QUAY_IMAGE }}:${{ steps.tag.outputs.tag }}
--platform ${{ env.CONTAINER_PLATFORMS }}
.