ci(github-actions): use custom PAT for force pushes and andd env for … #182
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy image to ghcr.io | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- v* | |
paths: | |
- cmd/** | |
- internal/** | |
- pkg/** | |
- Dockerfile | |
- .dockerignore | |
- .golangci.yml | |
- go.mod | |
- go.sum | |
jobs: | |
build_and_push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to ghcr.io | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3 | |
with: | |
registry: ghcr.io | |
username: src-csm | |
password: ${{ secrets.GHCR_PAT }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 # v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca # v3 | |
- name: Set created date for image | |
id: build_date | |
run: echo "CREATED=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT" | |
- name: Build and push final image | |
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/386,linux/arm/v6,linux/arm/v7 | |
tags: | | |
ghcr.io/src-doo/netbox-ssot:latest | |
ghcr.io/src-doo/netbox-ssot:${{ github.ref_name }} | |
push: true | |
build-args: | | |
VERSION=${{ github.ref_name }} | |
CREATED=${{ steps.build_date.outputs.CREATED }} | |
COMMIT=${{ github.sha }} |