From 81526633713589acb06b55c5e6f7842991e6f2b1 Mon Sep 17 00:00:00 2001 From: Krisztian Gacsal Date: Mon, 6 Nov 2023 08:07:35 +0100 Subject: [PATCH] ci: publish release * generate changelog * upload artifacts * switch to ncipollo/release-action publishing releases --- .github/workflows/release.yaml | 51 +++++++++++++++------------------ .goreleaser.yml | 52 ---------------------------------- 2 files changed, 23 insertions(+), 80 deletions(-) delete mode 100644 .goreleaser.yml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 31d7723205..9c3646c2b1 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,6 +3,7 @@ on: push: tags: - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" permissions: packages: write @@ -48,8 +49,8 @@ jobs: VERSION: ${{ github.ref_name }} run: make publish-helm-chart - manifests: - name: Create manifests + artifacts: + name: Create artifacts runs-on: ubuntu-latest steps: - name: Checkout @@ -102,11 +103,13 @@ jobs: - name: Upload uses: actions/upload-artifact@v3 with: - name: manifests + name: artifacts path: | dist/*.tar.gz dist/*.tgz dist/*.sha256sum + dist/bicep/vmclarity.json + dist/bicep/vmclarity-UI.json if-no-files-found: error main_release: @@ -114,41 +117,33 @@ jobs: - verification - build_and_push - publish_helm - - manifests + - artifacts name: Release runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Go - uses: actions/setup-go@v4 + - name: Download artifacts + uses: actions/download-artifact@v3 with: - # NOTE(chrisgacsal): Use actions/cache for caching Go dependency and build caches - # as if provides better flexibility like setting the cache key which reduces cache misses significantly. - cache: false - go-version-file: 'go.mod' + name: artifacts + path: dist - - name: Setup Go caching - uses: actions/cache@v3 - with: - path: | - ~/.cache/go-build - ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ github.ref_name }}-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go-${{ github.ref_name }}- - ${{ runner.os }}-go-${{ github.event.repository.default_branch }}- + - name: Generate changelog + env: + VERSION: ${{ github.ref_name }} + run: make generate-release-notes - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5 + - uses: ncipollo/release-action@v1 with: - version: v1.16.0 - args: release --clean --skip-validate - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + allowUpdates: true + artifactErrorsFailBuild: true + artifacts: "dist/*.tar.gz,dist/*.sha256sum,dist/bicep/vmclarity.json,dist/bicep/vmclarity-UI.json" + bodyFile: "dist/CHANGELOG.md" + draft: true + name: "Release ${{ github.ref_name }}" + updateOnlyUnreleased: true # TODO(sambetts) We need to publish a tag in the format "api/" tag # so that go mod is able to import the api module without overriding. We need diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index 87121a4b24..0000000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,52 +0,0 @@ -builds: - - - id: "cli" - dir: cli - binary: vmclarity-cli - env: - - CGO_ENABLED=0 - ldflags: - - "-s -w" - - "-X github.com/openclarity/vmclarity/pkg/version.Version={{ .Version }}" - - "-X github.com/openclarity/vmclarity/pkg/version.CommitHash={{.Commit}}" - - "-X github.com/openclarity/vmclarity/pkg/version.BuildTimestamp={{.Timestamp}}" - goos: - - linux - - darwin - goarch: - - amd64 - - arm64 - -archives: - - - id: "cli" - name_template: "{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}" - - # Additional files/template/globs we want to add to the archive. - files: - - LICENSE - - README.md - -checksum: - name_template: 'checksums.txt' - -# Change the default artifacts folder -dist: goreleaser_artifacts - -snapshot: - name_template: "{{ incpatch .Version }}-next" - -changelog: - sort: asc - use: github-native - filters: - exclude: - - '^docs:' - - '^test:' - - '^workflow:' - - Merge pull request - - Merge remote-tracking branch - -release: - extra_files: - - glob: ./installation/aws/VmClarity.cfn