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 7774b01 commit f8ca3e4
Show file tree
Hide file tree
Showing 12 changed files with 436 additions and 37 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
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.'

inputs:
plugin-version:
description: "Kestra version"
default: 'LATEST'
required: true

outputs:
docker-tag:
description: "The Docker image Tag for Kestra"
value: ${{ steps.vars.outputs.tag }}
description: "The Docker image Tag for Kestra"
docker-artifact-name:
description: "The GitHub artifact containing the Kestra docker image."
value: ${{ steps.vars.outputs.artifact }}
description: "The GitHub artifact containing the Kestra docker image name."
plugins:
description: "The Kestra plugins to be used for the build."
value: ${{ steps.plugins-list.outputs.plugins }}
description: "The Kestra plugins list used for the build."

runs:
using: composite
name: Build Artifacts
outputs:
docker-tag: ${{ steps.vars.outputs.tag }}
docker-artifact-name: ${{ steps.vars.outputs.artifact }}
plugins: ${{ steps.plugins-list.outputs.plugins }}
steps:
- name: Checkout current ref
uses: actions/checkout@v4
Expand All @@ -44,12 +45,13 @@ runs:
if: "!startsWith(github.ref, 'refs/tags/v')"
id: plugins-list
with:
plugin-version: ${{ env.PLUGIN_VERSION }}
plugin-version: ${{ inputs.plugin-version }}

# Set Plugins List
- name: Set Plugin List
id: plugins
if: "!startsWith(github.ref, 'refs/tags/v')"
shell: bash
run: |
PLUGINS="${{ steps.plugins-list.outputs.plugins }}"
TAG=${GITHUB_REF#refs/*/}
Expand All @@ -59,20 +61,21 @@ runs:
echo "plugins=--repositories=https://s01.oss.sonatype.org/content/repositories/snapshots $PLUGINS" >> $GITHUB_OUTPUT
fi
# Build
- name: Build with Gradle
shell: bash
run: |
./gradlew executableJar
- name: Copy exe to image
shell: bash
run: |
cp build/executable/* docker/app/kestra && chmod +x docker/app/kestra
# Docker Tag
- name: Set up Vars
id: vars
shell: bash
run: |
TAG=${GITHUB_REF#refs/*/}
if [[ $TAG = "master" ]]
Expand All @@ -90,7 +93,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 Expand Up @@ -132,4 +134,12 @@ runs:
if: "!startsWith(github.ref, 'refs/tags/v')"
with:
name: ${{ steps.vars.outputs.artifact }}
path: /tmp/${{ steps.vars.outputs.artifact }}.tar
path: /tmp/${{ steps.vars.outputs.artifact }}.tar

- name: Set outputs
id: set-outputs
shell: bash
run: |
echo "docker-tag=${{ steps.vars.outputs.tag }}" >> GITHUB_OUTPUT
echo "docker-artifact-name=${{ steps.vars.outputs.artifact }}" >> GITHUB_OUTPUT
echo "plugins=${{ steps.plugins.outputs.plugins }}" >> GITHUB_OUTPUT
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,15 +7,14 @@ inputs:
codecov-token:
description: 'Codecov Token'
required: true


runs:

using: composite
steps:
- id: checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }} # Using ref in case translations has committed something
ref: ${{ github.head_ref }}

- name: Npm install
shell: bash
Expand Down Expand Up @@ -51,10 +50,10 @@ runs:
working-directory: ui
run: npm run build-storybook --quiet

- name: Serve Storybook and run tests
- name: Storybook - Run tests
shell: bash
working-directory: ui
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:127.0.0.1:6006 && npm run test-storybook"
"npx wait-on tcp:127.0.0.1:6006 && npm run test:storybook"
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
Loading

0 comments on commit f8ca3e4

Please sign in to comment.