Skip to content

Commit

Permalink
trigger Native Image Release on both workflow_call and workflow_dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
mkjsix committed Oct 24, 2024
1 parent b20b216 commit 65379f3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
36 changes: 19 additions & 17 deletions .github/workflows/native-image.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
name: Native Image Release

on:
workflow_run:
workflows: ["Stable Release"]
branches: ["8.1.x"]
types:
- completed
# Triggered by other workflows using workflow_call
workflow_call:
inputs:
version:
description: "Version to release"
required: true
type: string
# Also allow manual triggering
workflow_dispatch:
inputs:
version:
description: "Version to release"
required: true
type: string

jobs:
build-and-upload:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
arch: "linux-amd64"
- os: windows-latest
arch: "windows-amd64"
runs-on: ${{ matrix.os }}
timeout-minutes: 20
outputs:
ubuntu: ${{ steps.set-output.outputs.ubuntu }}
Expand Down Expand Up @@ -73,7 +81,7 @@ jobs:
const isWindows = '${{ matrix.os }}' === 'windows-latest';
const filePath = isWindows ? 'core/target/restheart.exe' : 'core/target/restheart';
const fileName = `restheart-${{ matrix.arch }}${isWindows ? '.exe' : ''}`;
const releaseTag = '8.1.0'; // Consider making this an input parameter
const releaseTag = '${{ inputs.version }}'; // Use the passed version input
try {
const content = await fs.readFile(filePath);
Expand Down Expand Up @@ -150,18 +158,12 @@ jobs:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Set VERSION
id: vars
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Extract Version Components
id: extract_version
run: |
MAJOR=$(echo "${{ env.VERSION }}" | cut -d '.' -f 1)
MINOR=$(echo "${{ env.VERSION }}" | cut -d '.' -f 2)
PATCH=$(echo "${{ env.VERSION }}" | cut -d '.' -f 3)
MAJOR=$(echo "${{ inputs.version }}" | cut -d '.' -f 1)
MINOR=$(echo "${{ inputs.version }}" | cut -d '.' -f 2)
PATCH=$(echo "${{ inputs.version }}" | cut -d '.' -f 3)
# Export the major, minor, and patch versions as environment variables
echo "MAJOR=$MAJOR" >> $GITHUB_ENV
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This workflow builds stable releases

name: Stable Release

on:
Expand All @@ -13,7 +11,7 @@ jobs:
# Build and test the project
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ["5.0", "6.0"]
Expand All @@ -37,7 +35,7 @@ jobs:
# Deploy the project to Maven Central and DockerHub
deploy:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
strategy:
matrix:
mongodb-version: ["7.0"]
Expand Down Expand Up @@ -100,7 +98,6 @@ jobs:
echo "MINOR=$MINOR" >> $GITHUB_ENV
echo "PATCH=$PATCH" >> $GITHUB_ENV
- name: Set Docker Tags for standard images
id: set_tags
run: |
Expand Down Expand Up @@ -172,3 +169,10 @@ jobs:
core/target/restheart.zip
draft: true
prerelease: false

- name: Call Native Image Release
uses: ./.github/workflows/native-image.yml
with:
version: "${{ env.VERSION }}"
# Continue the calling workflow even if the called workflow fails
continue-on-error: true

0 comments on commit 65379f3

Please sign in to comment.