Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: refactor release #906

Merged
merged 12 commits into from
Nov 7, 2023
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.github
.git
bin
charts
docs
e2e
img
installation
scanner_boot_test
.envrc
Dockerfile*
dist
113 changes: 96 additions & 17 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,21 +24,37 @@ jobs:
push: true
use_release_repository: true

main_release:
needs: build_and_push
name: Release
publish_helm:
needs: verification
name: Publish Helm Chart
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create Helm Chart package
env:
VERSION: ${{ github.ref_name }}
run: make dist-helm-chart

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
fetch-depth: 0
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Package and Publish Helm Chart
env:
VERSION: ${{ github.ref_name }}
run: make publish-helm-chart

- name: Render cloudformation
id: render_cloudformation
run: |
sed -i -E 's@(ghcr\.io\/openclarity\/vmclarity\-(apiserver|cli|orchestrator|ui-backend|ui)):latest@\1:${{ github.ref_name }}@' \
installation/aws/VmClarity.cfn
artifacts:
name: Create artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
Expand All @@ -53,18 +70,80 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ github.ref_name }}-${{ hashFiles('**/go.sum') }}
key: ${{ runner.os }}-go-api-${{ github.ref_name }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ github.ref_name }}-
${{ runner.os }}-go-${{ github.event.repository.default_branch }}-
${{ runner.os }}-go-api-${{ github.ref_name }}-
${{ runner.os }}-go-api-${{ github.event.repository.default_branch }}-

- name: Create vmclarity-cli manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-vmclarity-cli

- name: Create Cloudformation manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-cloudformation

- name: Create Azure Bicep manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-bicep

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
- name: Create Docker Compose manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-docker-compose

- name: Create Google Cloud Deployment manifest(s)
env:
VERSION: ${{ github.ref_name }}
run: make dist-gcp-deployment

- name: Upload
uses: actions/upload-artifact@v3
with:
version: v1.16.0
args: release --clean --skip-validate
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:
needs:
- verification
- build_and_push
- publish_helm
- artifacts
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: dist

- name: Generate changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref_name }}
run: make generate-release-notes

- uses: ncipollo/release-action@v1
with:
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/<version>" tag
# so that go mod is able to import the api module without overriding. We need
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ bin/
db.db
ui/build/
site/
dist
52 changes: 0 additions & 52 deletions .goreleaser.yml

This file was deleted.

Loading