CI #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
workflow_dispatch: | |
inputs: | |
release: | |
description: "Use 'major' for incompatible changes, 'minor' for new features, and 'patch' for fixes or 'no_release' to trigger the pipeline without doing a release." | |
type: choice | |
options: | |
- "no_release" | |
- "major" | |
- "minor" | |
- "patch" | |
required: true | |
default: "no_release" | |
push: | |
branches: [ main] | |
tags: ["v*"] | |
pull_request: | |
repository_dispatch: | |
schedule: | |
# rebuild image every sunday | |
- cron: "0 0 * * 0" | |
jobs: | |
# sets the release kind when it wasn't triggered by an workflow dispatch | |
# this prevents us from having to pass down all labels, event_name, etc | |
# to init.yml | |
init: | |
uses: ./.github/workflows/init.yaml | |
with: | |
release: ${{ inputs.release }} | |
unittests: | |
name: unit-tests | |
uses: ./.github/workflows/tests.yml | |
build: | |
needs: [unittests] | |
uses: ./.github/workflows/build.yml | |
linting: | |
uses: ./.github/workflows/linting.yml | |
functional: | |
needs: [build] | |
uses: ./.github/workflows/functional.yaml | |
container: | |
needs: [build, init, functional] | |
uses: ./.github/workflows/push-container.yml | |
secrets: | |
dockerhub_user: ${{ secrets.DOCKERHUB_USERNAME }} | |
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN}} | |
with: | |
is_latest_tag: ${{needs.init.outputs.docker_build_is_latest}} | |
is_version_tag: ${{needs.init.outputs.docker_build_is_version }} | |
container-testing: | |
name: container | |
needs: [init, build ] | |
uses: ./.github/workflows/push-container-testing.yml | |
secrets: | |
dockerhub_user: ${{ secrets.DOCKERHUB_USERNAME }} | |
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN}} | |
with: | |
is_latest_tag: ${{needs.init.outputs.docker_build_is_latest}} | |
is_version_tag: ${{needs.init.outputs.docker_build_is_version}} | |
container-oldstable: | |
name: container | |
needs: [init, build ] | |
uses: ./.github/workflows/push-container-oldstable.yml | |
secrets: | |
dockerhub_user: ${{ secrets.DOCKERHUB_USERNAME }} | |
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN}} | |
with: | |
is_latest_tag: ${{needs.init.outputs.docker_build_is_latest}} | |
is_version_tag: ${{needs.init.outputs.docker_build_is_version}} | |
smoketests: | |
# on a PR we don't push container, therefore this can be skipped | |
if: github.event_name != 'pull_request' | |
needs: [container, init] | |
uses: ./.github/workflows/smoketest.yaml | |
with: | |
docker_repo: ${{ github.repository }} | |
docker_tag: ${{needs.init.outputs.docker_test_tag}} | |
helm: | |
needs: [smoketests] | |
if: vars.IMAGE_REGISTRY != '' | |
uses: ./.github/workflows/push-helm-chart.yml | |
secrets: | |
user: ${{ secrets.GREENBONE_BOT }} | |
token: ${{ secrets.GREENBONE_BOT_PACKAGES_WRITE_TOKEN }} | |
with: | |
registry: ${{ vars.IMAGE_REGISTRY }} | |
release: | |
needs: [smoketests, init] | |
if: ( needs.init.outputs.release_kind == 'major' || needs.init.outputs.release_kind == 'minor' || needs.init.outputs.release_kind == 'patch' ) | |
uses: ./.github/workflows/release.yml | |
with: | |
new_version: ${{ needs.init.outputs.release_new_version }} | |
latest_version: ${{ needs.init.outputs.release_latest_version }} | |
release_kind: ${{ needs.init.outputs.release_kind }} | |
release_ref: ${{ needs.init.outputs.release_ref }} | |
project: ${{ needs.init.outputs.release_project }} | |
repository: ${{ github.repository }} | |
secrets: | |
token: ${{ secrets.GREENBONE_BOT_TOKEN }} | |
name: ${{ secrets.GREENBONE_BOT }} | |
email: ${{ secrets.GREENBONE_BOT_MAIL }} | |
gpg_key: ${{ secrets.GPG_KEY }} | |
gpg_pass: ${{ secrets.GPG_PASSPHRASE }} |