github.com/vmware/govmomi@v0.51.0/.github/workflows/govmomi-build.yaml (about)

     1  name: Build
     2  
     3  permissions:
     4    contents: read
     5  
     6  on:
     7    push:
     8      branches: main
     9    pull_request:
    10      branches: main
    11    schedule:
    12      - cron: 0 1 * * *
    13    workflow_dispatch:
    14  
    15  concurrency:
    16    group: govmomi-build-${{ github.head_ref || github.run_id }}
    17    cancel-in-progress: true
    18  
    19  jobs:
    20    artifacts:
    21      name: Build Snapshot Release (no upload)
    22      runs-on: ubuntu-latest
    23      timeout-minutes: 15
    24      steps:
    25        - name: Checkout Repository
    26          uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
    27          with:
    28            fetch-depth: 0 # for CHANGELOG
    29  
    30        - name: Setup Go
    31          uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
    32          with:
    33            go-version-file: go.mod
    34  
    35        - name: Restore Go Cache
    36          uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
    37          with:
    38            path: |
    39              ~/.cache/go-build
    40              ~/go/pkg/mod
    41            key: ${{ runner.os }}-go-1.22-${{ hashFiles('**/go.sum') }}
    42            restore-keys: |
    43              ${{ runner.os }}-go-1.22-
    44  
    45        - name: Create CHANGELOG
    46          env:
    47            IMAGE: quay.io/git-chglog/git-chglog
    48            # https://quay.io/repository/git-chglog/git-chglog from tag v0.14.2
    49            IMAGE_SHA: 998e89dab8dd8284cfff5f8cfb9e9af41fe3fcd4671f2e86a180e453c20959e3
    50          run: |
    51            # use a pseudo tag to only include changes since last release
    52            NEXT_TAG=$(git describe --abbrev=0 --tags)-next
    53            docker run --rm -v $PWD:/workdir ${IMAGE}@sha256:${IMAGE_SHA} --next-tag ${NEXT_TAG} -o RELEASE_CHANGELOG.md --sort semver --tag-filter-pattern '^v[0-9]+' ${NEXT_TAG}
    54  
    55        - name: Archive CHANGELOG
    56          uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
    57          with:
    58            name: CHANGELOG
    59            path: |
    60              ./RELEASE_CHANGELOG.md
    61            retention-days: 1
    62  
    63        - name: Build Artifacts
    64          uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
    65          env:
    66            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    67          with:
    68            version: latest
    69            # Snapshot will disable push/release.
    70            args: release --clean --snapshot --release-notes RELEASE_CHANGELOG.md
    71  
    72        - name: Verify git clean
    73          shell: bash
    74          run: |
    75            if [[ -z "$(git status --porcelain)" ]]; then
    76              echo "${{ github.repository }} up to date."
    77            else
    78              echo "${{ github.repository }} is dirty."
    79              echo "::error:: $(git status)"
    80              exit 1
    81            fi
    82  
    83        # Make artifacts available for inspection.
    84        # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow
    85        - name: Archive Artifacts
    86          uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
    87          with:
    88            name: dist
    89            # Upload some artifacts for introspection to keep storage size small.
    90            path: |
    91              dist/govc_*x86_64.tar.gz
    92              dist/vcsim_*x86_64.tar.gz
    93              dist/checksums.txt
    94            retention-days: 1