chore(deps): update actions/checkout digest to f43a0e5 (#612) #409
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: release | |
on: | |
push: | |
branches: | |
- main | |
- '[0-9]+.[0-9]+.x' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
release-please: | |
permissions: | |
contents: write # for google-github-actions/release-please-action to create release commit | |
pull-requests: write # for google-github-actions/release-please-action to create release PR | |
runs-on: ubuntu-latest | |
outputs: | |
releases_created: ${{ steps.release.outputs.releases_created }} | |
tag_name: ${{ steps.release.outputs.tag_name }} | |
# Release-please creates a PR that tracks all changes | |
steps: | |
- name: Checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
- uses: google-github-actions/release-please-action@ca6063f4ed81b55db15b8c42d1b6f7925866342d # v3 | |
id: release | |
with: | |
command: manifest | |
token: ${{secrets.GITHUB_TOKEN}} | |
default-branch: main | |
goreleaser: | |
if: needs.release-please.outputs.releases_created == 'true' | |
permissions: | |
contents: write | |
needs: | |
- release-please | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4 | |
with: | |
go-version: '1.20' | |
- name: Download Syft | |
uses: anchore/sbom-action/download-syft@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@3fa32b8bb5620a2c1afe798654bbad59f9da4906 # v4 | |
with: | |
# either 'goreleaser' (default) or 'goreleaser-pro' | |
distribution: goreleaser | |
version: latest | |
args: release --clean | |
env: | |
GITHUB_TOKEN: ${{ secrets.K8SGPT_BOT_SECRET }} | |
build-container: | |
if: needs.release-please.outputs.releases_created == 'true' | |
needs: | |
- release-please | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: write | |
packages: write | |
id-token: write | |
env: | |
IMAGE_TAG: ghcr.io/k8sgpt-ai/k8sgpt:${{ needs.release-please.outputs.tag_name }} | |
IMAGE_NAME: k8sgpt | |
steps: | |
- name: Checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
with: | |
submodules: recursive | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2 | |
with: | |
registry: "ghcr.io" | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Image | |
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4 | |
with: | |
context: . | |
file: ./container/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
target: production | |
tags: | | |
${{ env.IMAGE_TAG }} | |
builder: ${{ steps.buildx.outputs.name }} | |
push: true | |
cache-from: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_TAG }} | |
cache-to: type=gha,scope=${{ github.ref_name }}-${{ env.IMAGE_TAG }} | |
- name: Generate SBOM | |
uses: anchore/sbom-action@78fc58e266e87a38d4194b2137a3d4e9bcaf7ca1 # v0.14.3 | |
with: | |
image: ${{ env.IMAGE_TAG }} | |
artifact-name: sbom-${{ env.IMAGE_NAME }} | |
output-file: ./sbom-${{ env.IMAGE_NAME }}.spdx.json | |
- name: Attach SBOM to release | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 | |
with: | |
tag_name: ${{ needs.release-please.outputs.tag_name }} | |
files: ./sbom-${{ env.IMAGE_NAME }}.spdx.json |