name: "Release" permissions: {} # there should never be two releases in progress at the same time concurrency: group: release cancel-in-progress: false on: workflow_dispatch: inputs: version: description: tag the latest commit on main with the given version (prefixed with v) required: true phase: description: the specific workflow phase to run or all required: true default: "all" type: choice options: - "all" - "install-script-only" skip-checks: description: skip the check-gate (release even if checks haven't passed on main) type: boolean default: false required: false jobs: version-available: if: ${{ github.event.inputs.phase == 'all' }} permissions: contents: read # required for fetching tags uses: anchore/workflows/.github/workflows/check-version-available.yaml@7212994dc8fc3a53fe9c8e766ab5b4ddd16ea3d4 # v0.8.0 with: version: ${{ github.event.inputs.version }} check-gate: if: ${{ github.event.inputs.phase == 'all' && !inputs.skip-checks }} permissions: contents: read checks: read # required for getting the status of specific check names uses: anchore/workflows/.github/workflows/check-gate.yaml@7212994dc8fc3a53fe9c8e766ab5b4ddd16ea3d4 # v0.8.0 with: # these are checks that should be run on pull-request and merges to main. # we do NOT want to kick off a release if these have not been verified on main. # Please see the validations.yaml workflow for the names that should be used here. checks: '["Acceptance tests (Linux)", "Acceptance tests (Mac)", "Build snapshot artifacts", "CLI tests (Linux)", "Integration tests", "Static analysis", "Unit tests"]' release: needs: [check-gate, version-available] # run even when check-gate is skipped, but never when version-available # failed/was skipped, nor when check-gate failed or was cancelled. note: # always() disables the implicit success() gate on ALL needs, so the # version-available requirement must be re-asserted explicitly here. if: >- ${{ always() && needs.version-available.result == 'success' && !contains(fromJSON('["failure", "cancelled"]'), needs.check-gate.result) }} environment: release # runs-on.com: compute instances for parallel builds # spot disabled: reliability for build workflows (used for releases too) # goreleaser uses parallelism of 12, so we need more CPUs # s3-cache: faster actions cache # volume: enlarge dist/ disk -- the default 40GB EBS root fills up during the multi-arch # image + binary build and OOMs (runs out of disk); size it well above peak usage. # provisioned throughput/iops above the gp3 free baseline (125mbs/3000iops) approximate # the tmpfs IO speed on disk, for ~1c/run. # note: tmpfs intentionally omitted -- a RAM-backed dist/ never touches the enlarged # volume and competes with the build's memory peak, so keep dist/ on disk. runs-on: runs-on=${{ github.run_id }}/cpu=16+32/ram=32+128/family=c5+c6+c7+c8/spot=false/extras=s3-cache/volume=120gb:gp3:500mbs:4000iops permissions: contents: write # required for creating the GitHub release and pushing the version tag packages: write # required for publishing release artifacts to GitHub packages id-token: write # required for keyless signing (cosign/sigstore OIDC) steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 #v7.0.1 with: fetch-depth: 0 persist-credentials: true - name: Bootstrap environment uses: ./.github/actions/bootstrap # dockers_v2 builds multi-platform manifests in a single buildx invocation, which requires a # docker-container driver builder (the default builder on the runner cannot build multi-platform). - name: Set up Docker Buildx uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 - name: Login to Docker Hub uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 #v4.5.1 with: username: ${{ secrets.ANCHOREOSSWRITE_DH_USERNAME }} password: ${{ secrets.ANCHOREOSSWRITE_DH_PAT }} - name: Login to GitHub Container Registry uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 #v4.5.1 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build & publish release artifacts run: make ci-release env: # for pushing tags (does not inherit workflow permissions) TAG_TOKEN: ${{ secrets.TAG_TOKEN }} RELEASE_VERSION: ${{ github.event.inputs.version }} # for mac signing and notarization... QUILL_SIGN_P12: ${{ secrets.ANCHORE_APPLE_DEVELOPER_ID_CERT_CHAIN }} QUILL_SIGN_PASSWORD: ${{ secrets.ANCHORE_APPLE_DEVELOPER_ID_CERT_PASS }} QUILL_NOTARY_ISSUER: ${{ secrets.APPLE_NOTARY_ISSUER }} QUILL_NOTARY_KEY_ID: ${{ secrets.APPLE_NOTARY_KEY_ID }} QUILL_NOTARY_KEY: ${{ secrets.APPLE_NOTARY_KEY }} # for creating the release (requires write access to packages and content) GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for updating brew formula in anchore/homebrew-syft GITHUB_BREW_TOKEN: ${{ secrets.ANCHOREOPS_GITHUB_OSS_WRITE_TOKEN }} - uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 #v0.24.0 continue-on-error: true with: file: go.mod artifact-name: sbom.spdx.json release-install-script: needs: [release] if: ${{ always() && (needs.release.result == 'success' || github.event.inputs.phase == 'install-script-only') }} permissions: contents: read # required for the reusable workflow to check out the repo and publish the install script uses: anchore/workflows/.github/workflows/release-install-script.yaml@7212994dc8fc3a53fe9c8e766ab5b4ddd16ea3d4 # v0.8.0 with: tag: ${{ github.event.inputs.version }} secrets: # needed for r2... R2_INSTALL_ACCESS_KEY_ID: ${{ secrets.OSS_R2_INSTALL_ACCESS_KEY_ID }} R2_INSTALL_SECRET_ACCESS_KEY: ${{ secrets.OSS_R2_INSTALL_SECRET_ACCESS_KEY }} R2_ENDPOINT: ${{ secrets.TOOLBOX_CLOUDFLARE_R2_ENDPOINT }} # needed for s3... S3_INSTALL_AWS_ACCESS_KEY_ID: ${{ secrets.TOOLBOX_AWS_ACCESS_KEY_ID }} S3_INSTALL_AWS_SECRET_ACCESS_KEY: ${{ secrets.TOOLBOX_AWS_SECRET_ACCESS_KEY }}