Skip to content

Commit

Permalink
fix(): first iteration of new main workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Skraye committed Feb 10, 2025
1 parent 7448dea commit 9623a01
Show file tree
Hide file tree
Showing 12 changed files with 393 additions and 26 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Basic Multi-Step Action'
description: 'A basic GitHub Action that runs multiple steps.'
name: 'Build Artifacts'
description: 'Build Jar & Docker image, upload artifacts, and push the docker image to the registry.'

outputs:
docker-tag:
Expand Down Expand Up @@ -59,7 +59,6 @@ runs:
echo "plugins=--repositories=https://s01.oss.sonatype.org/content/repositories/snapshots $PLUGINS" >> $GITHUB_OUTPUT
fi
# Build
- name: Build with Gradle
run: |
Expand All @@ -69,7 +68,6 @@ runs:
run: |
cp build/executable/* docker/app/kestra && chmod +x docker/app/kestra
# Docker Tag
- name: Set up Vars
id: vars
Expand All @@ -90,7 +88,6 @@ runs:
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "artifact=docker-kestra-${TAG}" >> $GITHUB_OUTPUT
# Docker setup
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Frontend Test'
name: Frontend Test

inputs:
github-token:
Expand All @@ -7,9 +7,8 @@ inputs:
codecov-token:
description: 'Codecov Token'
required: true


runs:

using: composite
steps:
- id: checkout
Expand Down
48 changes: 48 additions & 0 deletions .github/actions/github-release/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Github Release
description: Create a Github Release
inputs:
github-token:
description: 'Github Token'
required: true
gh-personal:
description: 'Github Personal Token'
required: true

runs:
using: composite
name: Github Release
steps:
# Download Exec
- name: Artifacts - Download executable
uses: actions/download-artifact@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
name: exe
path: build/executable

# GitHub Release
- name: GitHub - Create release
id: create_github_release
uses: "marvinpinto/action-automatic-releases@latest"
if: startsWith(github.ref, 'refs/tags/v')
continue-on-error: true
with:
repo_token: "${{ inputs.github-token }}"
prerelease: false
files: |
build/executable/*
# Trigger gha workflow to bump helm chart version
- name: GitHub - Trigger the Helm chart version bump
uses: peter-evans/repository-dispatch@v3
if: steps.create_github_release.conclusion == 'success'
with:
token: ${{ inputs.gh-personal }}
repository: kestra-io/helm-charts
event-type: update-helm-chart-version
client-payload: |-
{
"new_version": "${{ github.ref_name }}",
"github_repository": "${{ github.repository }}",
"github_actor": "${{ github.actor }}"
}
81 changes: 81 additions & 0 deletions .github/actions/publish-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Publish Docker

inputs:
dockerhub-username:
description: 'DockerHub Username'
required: true
dockerhub-password:
description: 'DockerHub Password'
required: true
tag:
description: 'The Docker image Tag for Kestra'
required: true
plugins:
description: 'The Kestra plugins to be used for the build.'
required: false
packages:
description: 'The packages to be installed in the docker image.'
required: false
default: ""
python-libraries:
description: 'The python libraries to be installed in the docker image.'
required: false
default: ""

runs:
using: composite
name: Publish Docker
steps:
- name: Checkout - Current ref
uses: actions/checkout@v4

# Docker setup
- name: Docker - Setup QEMU
uses: docker/setup-qemu-action@v3

- name: Docker - Setup Docker Buildx
uses: docker/setup-buildx-action@v3

# Docker Login
- name: Docker - Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ inputs.dockerhub-username }}
password: ${{ inputs.dockerhub-password }}

# Vars
- name: Docker - Set image name
shell: bash
id: vars
run: |
TAG=${GITHUB_REF#refs/*/}
if [[ $TAG = "master" || $TAG == v* ]]; then
echo "plugins=${{ inputs.plugins }}" >> $GITHUB_OUTPUT
else
echo "plugins=--repositories=https://s01.oss.sonatype.org/content/repositories/snapshots ${{ inputs.plugins }}" >> $GITHUB_OUTPUT
fi
# Build Docker Image
- name: Artifacts - Download executable
uses: actions/download-artifact@v4
with:
name: exe
path: build/executable

- name: Docker - Copy exe to image
shell: bash
run: |
cp build/executable/* docker/app/kestra && chmod +x docker/app/kestra
# Docker Build and push
- name: Docker - Build image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: kestra/kestra:${{ inputs.tag }}
platforms: linux/amd64,linux/arm64
build-args: |
KESTRA_PLUGINS=${{ steps.vars.outputs.plugins }}
APT_PACKAGES=${{inputs.packages}}
PYTHON_LIBRARIES=${{inputs.python-libraries}}
55 changes: 55 additions & 0 deletions .github/actions/publish-maven/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Publish Maven
description: Publish Maven artifacts to Maven Central

inputs:
sonatype-username:
description: 'Sonatype Username'
required: true
sonatype-password:
description: 'Sonatype Password'
required: true
sonatype-gpg-keyid:
description: 'GPG Key ID'
required: true
sonatype-gpg-password:
description: 'GPG Password'
required: true
sonatype-gpg-file:
description: 'GPG File'
required: true

runs:
using: composite
name: Publish Maven
steps:
- name: Checkout - Current ref
uses: actions/checkout@v4

# Setup build
- name: Setup - Build
uses: kestra-io/actions/.github/actions/setup-build@main
id: build
with:
java-enabled: true
node-enabled: true

# Publish
- name: Publish - Release package to Maven Central
shell: bash
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ inputs.sonatype-username }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ inputs.sonatype-password }}
SONATYPE_GPG_KEYID: ${{ inputs.sonatype-gpg-keyid }}
SONATYPE_GPG_PASSWORD: ${{ inputs.sonatype-gpg-password }}
SONATYPE_GPG_FILE: ${{ inputs.sonatype-gpg-file }}
run: |
mkdir -p ~/.gradle/
echo "signing.keyId=${SONATYPE_GPG_KEYID}" > ~/.gradle/gradle.properties
echo "signing.password=${SONATYPE_GPG_PASSWORD}" >> ~/.gradle/gradle.properties
echo "signing.secretKeyRingFile=${HOME}/.gradle/secring.gpg" >> ~/.gradle/gradle.properties
echo ${SONATYPE_GPG_FILE} | base64 -d > ~/.gradle/secring.gpg
./gradlew publishToSonatype ${{ startsWith(github.ref, 'refs/tags/v') && 'closeAndReleaseSonatypeStagingRepository' || '' }}
# Gradle dependency
- name: Java - Gradle dependency graph
uses: gradle/actions/dependency-submission@v4
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Main

on:
# push:
# branches:
# - develop
push:
branches:
- develop
# tags:
# - v*
# pull_request:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true

env:
JAVA_VERSION: "21"
DOCKER_APT_PACKAGES: python3 python3-venv python-is-python3 python3-pip nodejs npm curl zip unzip
DOCKER_PYTHON_LIBRARIES: kestra
PLUGIN_VERSION: ${{ github.event.inputs.plugin-version != null && github.event.inputs.plugin-version || 'LATEST' }}
# to save corepack from itself
COREPACK_INTEGRITY_KEYS: 0

jobs:
file-changes:
name: File changes detection
Expand All @@ -36,6 +28,8 @@ jobs:
- 'ui/src/translations/**'
backend:
- '!{ui,.github}/**'
e2e:
- '!{.github}/**'
token: ${{ secrets.GITHUB_TOKEN }}

frontend:
Expand All @@ -50,15 +44,18 @@ jobs:
- id: generate-translations
name: Generate translations
if: "needs.file-changes.outputs.translations == 'true'"
uses: ./.github/actions/action-generate-translations
uses: ./.github/actions/generate-translations
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

- id: frontend-test
name: Frontend test
uses: ./.github/actions/action-frontend-test
uses: ./.github/actions/frontend-test
env:
# to save corepack from itself
COREPACK_INTEGRITY_KEYS: 0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -73,21 +70,21 @@ jobs:
- uses: actions/checkout@v4

- name: Backend test
uses: ./.github/actions/action-backend-test
uses: ./.github/actions/backend-test
with:
codecov-token: ${{ secrets.CODECOV_TOKEN }}
sonar-token: ${{ secrets.SONAR_TOKEN }}
github-token: ${{ secrets.GH_PERSONAL_TOKEN }}
google-service-account: ${{ secrets.GOOGLE_SERVICE_ACCOUNT }}

build-artifacts:
if: ${{ needs.file-changes.outputs.backend == 'true' || needs.file-changes.outputs.ui == 'true' }}
if: needs.file-changes.outputs.e2e == 'true'
name: Build artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/action-build-artifacts
- uses: ./.github/actions/build-artifacts
id: build-artifacts

e2e:
Expand Down
47 changes: 46 additions & 1 deletion .github/workflows/workflow-main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,47 @@
name: Main Workflow

on:
jobs:
push:
branches:
- develop
jobs:
tests:
name: Execute tests
uses: ./.github/workflows/workflow-test.yml

release:
name: Release
needs: [tests]
uses: ./.github/workflows/workflow-release.yml
with:
docker-tag: ${{ needs.tests.outputs.docker-tag }}
plugins: ${{ needs.tests.outputs.plugins }}

end:
runs-on: ubuntu-latest
needs:
- release
if: always()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
# Update
- name: Github - Update internal
uses: benc-uk/workflow-dispatch@v1
if: github.ref == 'refs/heads/develop' && needs.docker.result == 'success'
with:
workflow: oss-build.yml
repo: kestra-io/infra
ref: master
token: ${{ secrets.GH_PERSONAL_TOKEN }}

# Slack
- name: Slack - Notification
uses: Gamesight/slack-workflow-status@master
if: ${{ always() && env.SLACK_WEBHOOK_URL != 0 }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
name: GitHub Actions
icon_emoji: ":github-actions:"
channel: "C02DQ1A7JLR" # _int_git channel
Loading

0 comments on commit 9623a01

Please sign in to comment.