# Copyright 2023 The Archivista Contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. permissions: contents: read # This is required for actions/checkout name: pipeline on: push: tags: - v* branches: - main pull_request: jobs: fmt: uses: ./.github/workflows/witness.yml permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout with: pull_request: ${{ github.event_name == 'pull_request' }} step: static-analysis attestations: "github" command: go fmt ./... static_analysis: uses: ./.github/workflows/witness.yml permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout with: pull_request: ${{ github.event_name == 'pull_request' }} step: static-analysis attestations: "github" command: go vet ./... tests: needs: [fmt, static_analysis] uses: ./.github/workflows/witness.yml permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout with: pull_request: ${{ github.event_name == 'pull_request' }} step: "tests" attestations: "github" command: | make clean make test release: needs: tests permissions: id-token: write contents: write packages: write runs-on: ubuntu-latest if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') steps: - name: Harden Runner uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 with: egress-policy: audit - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0 with: go-version-file: "go.mod" - name: Login to GitHub Container Registry uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Download GoReleaser run: go install github.com/goreleaser/goreleaser@v1.23.0 - name: Run GoReleaser uses: testifysec/witness-run-action@7aa15e327829f1f2a523365c564c948d5dde69dd env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} with: witness-install-dir: /opt/witness version: 0.9.1 step: "build" attestations: "github" command: goreleaser release --clean