fix(ci): pre-generate changelog with git-cliff, verify install, disab… #10
Workflow file for this run
This file contains hidden or 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
| # SPDX-License-Identifier: BSD-2-Clause | |
| # Copyright (c) 2026, Timo Pallach (timo@pallach.de). | |
| # Release: push an annotated tag v* (e.g. v0.1.2) to run GoReleaser and publish | |
| # GitHub Release artifacts. Requires GITHUB_TOKEN (default in Actions). | |
| # | |
| # v0.1.0 and v0.1.1 are manual releases (no GoReleaser); skip those tag refs. | |
| name: release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| goreleaser: | |
| if: ${{ github.ref != 'refs/tags/v0.1.0' && github.ref != 'refs/tags/v0.1.1' }} | |
| runs-on: ubuntu-latest | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Install git-cliff | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| CLIFF_VERSION=$(gh api repos/orhun/git-cliff/releases/latest --jq '.tag_name') | |
| curl --silent --show-error --location \ | |
| "https://github.com/orhun/git-cliff/releases/download/${CLIFF_VERSION}/git-cliff-${CLIFF_VERSION#v}-x86_64-unknown-linux-musl.tar.gz" \ | |
| | tar --extract --gzip --directory /tmp | |
| sudo install --mode=755 \ | |
| "$(find /tmp -maxdepth 2 -name git-cliff -type f)" \ | |
| /usr/local/bin/git-cliff | |
| git-cliff --version | |
| - name: Generate changelog | |
| run: git-cliff --latest --output /tmp/release-notes.md | |
| - name: Install syft | |
| uses: anchore/sbom-action/download-syft@v0 | |
| - name: Generate SBOM | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| syft scan dir:. \ | |
| --source-name packer-plugin-sylve \ | |
| --source-version "${VERSION}" \ | |
| --output cyclonedx-xml=sbom.cdx.xml | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| distribution: goreleaser | |
| version: "~> v2" | |
| args: release --clean --release-notes /tmp/release-notes.md | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload SBOM to release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TAG="${GITHUB_REF_NAME}" | |
| VERSION="${TAG#v}" | |
| gh release upload "${TAG}" \ | |
| "sbom.cdx.xml#packer-plugin-sylve_v${VERSION}_sbom.cdx.xml" |