diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 31ee977..10bbc4a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,11 @@ name: CI on: push: branches: - - main + - mima - release-* + - mima-release-* + tags: + - 'v*' pull_request: {} workflow_dispatch: inputs: @@ -23,7 +26,7 @@ env: # These environment variables are important to the Crossplane CLI install.sh # script. They determine what version it installs. - XP_CHANNEL: master # TODO(negz): Pin to stable once v1.14 is released. + XP_CHANNEL: stable # TODO(negz): Pin to stable once v1.14 is released. XP_VERSION: current # TODO(negz): Pin to a version once v1.14 is released. # This CI job will automatically push new builds to xpkg.upbound.io if the @@ -159,7 +162,7 @@ jobs: # XPKG_ACCESS_ID and XPKG_TOKEN secrets were provided. push: permissions: - contents: read + contents: write packages: write # for pushing to ghcr.io if: ${{ github.event_name != 'pull_request' }} runs-on: ubuntu-24.04 @@ -186,6 +189,13 @@ jobs: registry: xpkg.upbound.io username: ${{ secrets.XPKG_ACCESS_ID }} password: ${{ secrets.XPKG_TOKEN }} + + # On a v* tag push (created by crossplane-gitops/release-fork.yml at the + # head of a mima-release-* branch) the package is versioned after the tag. + # release-fork.yml then validates the signature of that exact package. + - name: Use Tag as Multi-Platform Package Version + if: env.XPKG_VERSION == '' && startsWith(github.ref, 'refs/tags/v') + run: echo "XPKG_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV # If a version wasn't explicitly passed as a workflow_dispatch input we # default to version v0.0.0--, for example @@ -200,6 +210,7 @@ jobs: run: "./crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.XPKG }}:${{ env.XPKG_VERSION }}" - name: Login to GHCR + if: startsWith(github.ref, 'refs/heads/mima-release-') || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/') uses: docker/login-action@06fb636fac595d6fb4b28a5dfcb21a6f5091859c # v4 with: registry: ghcr.io @@ -207,5 +218,52 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Push Multi-Platform Package to GHCR - if: env.XPKG_ACCESS_ID != '' + if: startsWith(github.ref, 'refs/heads/mima-release-') || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/') run: "./crossplane --verbose xpkg push --package-files $(echo *.xpkg|tr ' ' ,) ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }}" + - name: Install Cosign + if: startsWith(github.ref, 'refs/heads/mima-release-') || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/') + uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3 + - name: Sign OCI Package + if: startsWith(github.ref, 'refs/heads/mima-release-') || startsWith(github.ref, 'refs/heads/release-') || startsWith(github.ref, 'refs/tags/') + env: + COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_SIGNING_KEY }} + COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }} + run: | + cosign sign \ + --key env://COSIGN_PRIVATE_KEY \ + --tlog-upload=false \ + --yes \ + ${{ env.CROSSPLANE_REGORG }}:${{ env.XPKG_VERSION }} + - name: Publish GitHub Release with cosign.pub + if: startsWith(github.ref, 'refs/tags/') + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + if gh release view ${{ github.ref_name }} --repo ${{ github.repository }} >/dev/null 2>&1; then + gh release upload ${{ github.ref_name }} release/cosign.pub \ + --repo ${{ github.repository }} --clobber + else + gh release create ${{ github.ref_name }} release/cosign.pub \ + --repo ${{ github.repository }} \ + --title ${{ github.ref_name }} \ + --notes "mimacom signed release ${{ github.ref_name }}." + fi + codeql: + runs-on: ubuntu-24.04 + permissions: + contents: read + security-events: write + steps: + - name: Checkout + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 + + - name: Initialize CodeQL + uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4 + with: + languages: go + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4 + + diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..034e848 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,21 @@ +# Security Policy + +## Supported Versions + +Use this section to tell people about which versions of your project are +currently being supported with security updates. + +| Version | Supported | +| ------- | ------------------ | +| 5.1.x | :white_check_mark: | +| 5.0.x | :x: | +| 4.0.x | :white_check_mark: | +| < 4.0 | :x: | + +## Reporting a Vulnerability + +Use this section to tell people how to report a vulnerability. + +Tell them where to go, how often they can expect to get an update on a +reported vulnerability, what to expect if the vulnerability is accepted or +declined, etc. diff --git a/release/cosign.pub b/release/cosign.pub new file mode 100644 index 0000000..7882585 --- /dev/null +++ b/release/cosign.pub @@ -0,0 +1,4 @@ +-----BEGIN PUBLIC KEY----- +MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE+2595hYxY0xnVpQPCuKQube8LoCv +M2KCpe5WmuuGxxNkvmNuoF7+sTUACm3Qs7l+hT39abobuTUs2w2EV6PjyA== +-----END PUBLIC KEY-----