Skip to content

fix: test 2

fix: test 2 #9

Workflow file for this run

name: compage-release
on:
push:
branches:
- test
# tags:
# - "v*.*.*"
permissions:
contents: write
jobs:
push_to_registry:
name: Build and push Docker image github container registry.
runs-on: ubuntu-20.04
permissions:
packages: write
id-token: write
contents: read
actions: read
security-events: write
env:
REGISTRY: ghcr.io
GH_URL: https://github.com
steps:
- name: Set environment variable
run: |
echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- name: Test environment variable
run: echo ${{ env.RELEASE_VERSION }}
- name: Check out GitHub repo
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.GH_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: Build image and push to GitHub Container Registry
uses: docker/build-push-action@v4
with:
push: true
context: .
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.RELEASE_VERSION }}
# - uses: goodwithtech/dockle-action@main
# with:
# image: ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.run_id }}
# format: 'list'
# exit-code: '1'
# exit-level: 'warn'
# ignore: 'CIS-DI-0001,DKL-DI-0006'
- name: Install cosign
uses: sigstore/cosign-installer@main
- name: Sign the images
run: |
cosign sign -y ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.RELEASE_VERSION }}
env:
COSIGN_EXPERIMENTAL: 1
- name: Verify the pushed tags
run: cosign verify ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.RELEASE_VERSION }} --certificate-identity ${{ env.GH_URL }}/${{ github.repository }}/.github/workflows/release.yml@refs/tags/${{ env.RELEASE_VERSION }} --certificate-oidc-issuer https://token.actions.githubusercontent.com
env:
COSIGN_EXPERIMENTAL: 1
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
format: 'github'
output: 'dependency-results.sbom.json'
image-ref: '.'
github-pat: ${{ secrets.GH_TOKEN }}
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
token: ${{ secrets.GH_TOKEN }}
- run: git fetch --force --tags
- name: Initialize and update submodules
run: git submodule update --init --recursive
- uses: actions/setup-go@v4
with:
go-version: 1.21
- uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean --debug
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}