Skip to content

Bump github.com/go-viper/mapstructure/v2 from 2.0.0 to 2.3.0 #7

Bump github.com/go-viper/mapstructure/v2 from 2.0.0 to 2.3.0

Bump github.com/go-viper/mapstructure/v2 from 2.0.0 to 2.3.0 #7

name: Build & Release
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main
permissions:
contents: write
jobs:
native:
strategy:
matrix:
go: [ '1.22', '1.23' ]
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Checkout code
uses: actions/checkout@v2
- name: Build project
run: make build
- name: Execute CLI help
run: ./cobbler --help
- name: Upload binary Artifact
uses: actions/upload-artifact@v4
with:
name: cobbler-cli-binary-${{ matrix.go }}-${{ matrix.os }}
path: ./cobbler
rpm:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build RPM
run: make build-rpm-docker
- name: Upload RPM Artifact
uses: actions/upload-artifact@v4
with:
name: cobbler-cli-native-rpm
path: ./rpms/**/*.rpm
deb:
# This will fail until Debian 13 will arrive with a newer golang version
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build DEB
continue-on-error: true
run: make build-deb-docker
- name: Upload DEB Artifact
uses: actions/upload-artifact@v4
with:
name: cobbler-cli-native-deb
path: ./debs/**/*.deb
docker:
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
PUSH_IMAGE: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' }}
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
# https://github.com/docker/build-push-action
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./packaging/docker/production/Dockerfile
push: ${{ env.PUSH_IMAGE }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
# https://github.com/actions/attest-build-provenance
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: ${{ env.PUSH_IMAGE }}
goreleaser:
runs-on: ubuntu-latest
needs:
- native
- docker
- deb
- rpm
steps:
- name: Checkout
# https://github.com/actions/checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
# https://github.com/actions/setup-go
uses: actions/setup-go@v5
- name: Download all artifacts
# https://github.com/actions/download-artifact
id: download-artifact
uses: actions/download-artifact@v4
with:
pattern: "cobbler-cli-native-*"
- name: Import GPG key
# https://github.com/crazy-max/ghaction-import-gpg
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Run GoReleaser (tag)
# https://github.com/goreleaser/goreleaser-action
uses: goreleaser/goreleaser-action@v6
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run GoReleaser (draft)
uses: goreleaser/goreleaser-action@v6
if: "!startsWith(github.ref, 'refs/tags/')"
with:
version: latest
args: release --snapshot --clean
env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}