Skip to content

Commit

Permalink
refactor release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Isola committed Apr 30, 2024
1 parent b9cb87b commit 97f9af3
Show file tree
Hide file tree
Showing 11 changed files with 355 additions and 82 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/build_container.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
name: Release Mondoo Container Image

on:
release:
types: [released]
workflow_dispatch:

workflow_call:
inputs:
push:
description: "Push docker image?"
required: false
default: true
type: boolean
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true

jobs:
build_container:
Expand Down Expand Up @@ -55,7 +64,7 @@ jobs:
provenance: true
context: .
platforms: linux/amd64,linux/arm64
push: true
push: ${{ inputs.push }}
build-args: VERSION=${{ steps.version.outputs.version }}
target: root
tags: |
Expand All @@ -76,7 +85,7 @@ jobs:
context: .
file: Dockerfile-dev
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
push: true
push: ${{ inputs.push }}
build-args: VERSION=${{ steps.version.outputs.version }}
target: root
tags: |
Expand All @@ -91,7 +100,7 @@ jobs:
provenance: true
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7
push: true
push: ${{ inputs.push }}
build-args: VERSION=${{ steps.version.outputs.version }}
target: rootless
tags: |
Expand All @@ -107,7 +116,7 @@ jobs:
context: .
file: Dockerfile-ubi
platforms: linux/amd64,linux/arm64
push: true
push: ${{ inputs.push }}
build-args: VERSION=${{ steps.version.outputs.version }}
target: root
tags: |
Expand All @@ -123,11 +132,10 @@ jobs:
context: .
file: Dockerfile-ubi
platforms: linux/amd64,linux/arm64
push: true
push: ${{ inputs.push }}
build-args: VERSION=${{ steps.version.outputs.version }}
target: rootless
tags: |
mondoo/client:${{ steps.version.outputs.version }}-ubi-rootless
mondoo/client:${{ steps.semver.outputs.major }}-ubi-rootless
mondoo/client:latest-ubi-rootless
30 changes: 21 additions & 9 deletions .github/workflows/pkg_arch-aur.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
name: 'PKG: Archlinux AUR Release'

on:
workflow_call:
inputs:
version:
description: "Version to release"
required: true
default: "8.0.0"
type: string
skip:
description: "Skip release"
required: false
default: false
type: boolean
secrets:
AUR_USERNAME:
required: true
AUR_EMAIL:
required: true
AUR_SSH_PRIVATE_KEY:
required: true
workflow_dispatch:
inputs:
version:
Expand All @@ -13,8 +32,6 @@ on:
required: false
default: false
type: boolean
release:
types: [published]

jobs:
setup:
Expand All @@ -25,14 +42,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set Version (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
- name: Set Version
run: |
echo VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Set Version (Release Event)
if: github.event_name == 'release'
run: |
echo VERSION=${{ github.event.release.tag_name }} >> $GITHUB_ENV
- name: Unified Version
id: version
run: |
Expand Down Expand Up @@ -106,4 +118,4 @@ jobs:
packages/archlinux/mondoo/mondoo.sh
packages/archlinux/mondoo/LICENSE.html
packages/archlinux/mondoo/OSS-LICENSES.tar.xz
packages/archlinux/mondoo/mondoo.service
packages/archlinux/mondoo/mondoo.service
26 changes: 17 additions & 9 deletions .github/workflows/pkg_chocolatey.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
name: 'PKG: Chocolatey NuGet Release'

on:
workflow_call:
inputs:
version:
description: "Version to release"
required: true
type: string
default: "8.0.0"
skip-publish:
description: "Skip publish?"
required: false
default: false
type: boolean
secrets:
CHOCOLATEY_API_KEY:
required: true
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true
type: string
default: "8.0.0"
release:
types: [published]

jobs:
chocotize:
Expand All @@ -19,15 +32,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
# Determine which version should be released based on event type
- name: Set Version (Workflow Dispatch)
- name: Set Version
shell: bash
if: github.event_name == 'workflow_dispatch'
run: |
echo VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Set Version (Release Event)
if: github.event_name == 'release'
run: |
echo VERSION=${{ github.event.release.tag_name }} >> $GITHUB_ENV
- name: Unified Version
id: version
shell: bash
Expand All @@ -51,6 +59,7 @@ jobs:
- name: Update Chocolatey Packages
uses: addnab/docker-run-action@v3
if: ${{ ! inputs.skip-publish }}
with:
image: chocolatey/choco:latest
options: -v ${{ github.workspace }}/packages/chocolatey:/packages -e CHOCO_API_KEY=${{ secrets.CHOCOLATEY_API_KEY }} -e VERSION=${{ steps.version.outputs.version }}
Expand All @@ -64,4 +73,3 @@ jobs:
done
echo 'Go check for the moderation status:'
echo 'Mondoo Moderation Queue: https://community.chocolatey.org/packages?q=tag%3Amondoo&moderatorQueue=true&moderationStatus=all-statuses&prerelease=false&sortOrder=relevance'
52 changes: 44 additions & 8 deletions .github/workflows/pkg_macos.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,48 @@
name: 'PKG: macOS Universal pkg Release'

on:
workflow_call:
inputs:
version:
description: "Package Version"
required: true
default: "0.0.1"
type: string
name:
description: "Package Name"
required: false
default: "mondoo"
type: string
skip-publish:
description: "Skip publish?"
required: false
default: false
type: boolean
secrets:
APPLE_KEYCHAIN_PASSWORD:
required: true
APPLE_KEYS_PRODUCTSIGN_P12:
required: true
APPLE_KEYS_CODESIGN_P12:
required: true
APPLE_KEYS_PASSWORD:
required: true
APPLE_KEYS_CODESIGN_ID:
required: true
APPLE_KEYS_PRODUCTSIGN_ID:
required: true
APPLE_ACCOUNT_USERNAME:
required: true
APPLE_ACCOUNT_PASSWORD:
required: true
APPLE_ACCOUNT_TEAM_ID:
required: true
GCP_CREDENTIALS:
required: true
RELEASR_ACTION_TOKEN:
required: true
REPO_API_TOKEN:
required: true
workflow_dispatch:
inputs:
version:
Expand All @@ -11,13 +53,12 @@ on:
description: 'Package Name'
required: false
default: 'mondoo'
type: string
skip-publish:
description: 'Skip publish?'
required: false
default: false
type: boolean
release:
types: [released]

jobs:
pkg:
Expand All @@ -27,14 +68,9 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set Version (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
- name: Set Version
run: |
echo VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Set Version (Release Event)
if: github.event_name == 'release'
run: |
echo VERSION=${{ github.event.release.tag_name }} >> $GITHUB_ENV
- name: Unified Version
id: version
run: |
Expand Down
46 changes: 35 additions & 11 deletions .github/workflows/pkg_msi.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,55 @@
name: 'PKG: Microsoft Software Installer (MSI)'

on:
workflow_call:
inputs:
version:
description: "Package Version"
required: true
default: "0.0.1"
type: string
name:
description: "Package Name"
required: false
default: "mondoo"
type: string
skip-publish:
description: "Skip publish?"
required: false
default: false
type: boolean
secrets:
SM_CLIENT_CERT_FILE_B64:
required: true
SM_HOST:
required: true
SM_API_KEY:
required: true
SM_CLIENT_CERT_PASSWORD:
required: true
SM_CODE_SIGNING_CERT_SHA1_HASH:
required: true
GCP_CREDENTIALS:
required: true
RELEASR_ACTION_TOKEN:
required: true
workflow_dispatch:
inputs:
version:
description: 'Package Version'
required: true
default: '0.0.1'
type: string
name:
description: 'Package Name'
required: false
default: 'mondoo'
type: string
skip-publish:
description: 'Skip publish?'
required: false
default: false
type: boolean
release:
types: [published]

jobs:
setup:
Expand All @@ -28,14 +60,9 @@ jobs:
trimmed-version: ${{ steps.version.outputs.trimmed_version }}
name: ${{ steps.version.outputs.name }}
steps:
- name: Set Version (Workflow Dispatch)
if: github.event_name == 'workflow_dispatch'
- name: Set Version
run: |
echo VERSION=${{ inputs.version }} >> $GITHUB_ENV
- name: Set Version (Release Event)
if: github.event_name == 'release'
run: |
echo VERSION=${{ github.event.release.tag_name }} >> $GITHUB_ENV
- name: Unified Version
id: version
run: |
Expand All @@ -56,7 +83,6 @@ jobs:
curl -sL --head --fail https://github.com/mondoohq/cnquery/releases/download/v${{ steps.version.outputs.version }}/cnquery_${{ steps.version.outputs.version }}_windows_amd64.zip
curl -sL --head --fail https://github.com/mondoohq/cnspec/releases/download/v${{ steps.version.outputs.version }}/cnspec_${{ steps.version.outputs.version }}_windows_amd64.zip
dist-prepare:
name: 'Prepare Distribution for Packaging'
runs-on: ubuntu-latest
Expand All @@ -83,7 +109,6 @@ jobs:
name: dist
path: dist


msi-build:
name: 'Packaging: Windows MSI'
runs-on: windows-latest
Expand Down Expand Up @@ -216,4 +241,3 @@ jobs:
- name: Cleanup
run: |
rm -f "${{ steps.gauth.outputs.credentials_file_path }}"
Loading

0 comments on commit 97f9af3

Please sign in to comment.