Skip to content

Commit

Permalink
Add GH action to build min packages
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexRuiz7 committed Nov 24, 2023
1 parent a699b4d commit 7da1c0e
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 20 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build slim packages

# This workflow runs when any of the following occur:
# - Run manually
on:
workflow_dispatch:


# Used to run locally using https://github.com/nektos/act
env:
ACT:
VERSION: 2.11.0
SNAPSHOT: false
PLATFORM: linux
BUILD: bash scripts/build.sh
PACKAGE_NAME:


jobs:
build:
runs-on: ubuntu-latest
# Permissions to upload the package
permissions:
packages: write
contents: read
strategy:
matrix:
# For act:
# DISTRIBUTION: [ rpm ]
# ARCHITECTURE: [ x64 ]
DISTRIBUTION: [ tar, rpm, deb ]
ARCHITECTURE: [ x64, arm64 ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Setup Gradle
uses: gradle/[email protected]

- name: Execute build script
run: |
$BUILD -v $VERSION -s $SNAPSHOT -p $PLATFORM -a ${{ matrix.ARCHITECTURE }} -d ${{ matrix.DISTRIBUTION }}
# The package name is stored in the artifacts/artifact_name.txt file
- name: Read package name
id: package_name
run: |
echo $(ls -la)
echo "package_name=$(cat artifacts/artifact_name.txt)" >> $GITHUB_OUTPUT
echo "$(cat artifacts/artifact_name.txt)"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.package_name.outputs.package_name }}
path: artifacts/dist/${{ steps.package_name.outputs.package_name }}
if-no-files-found: error

# assemble:
# release:
19 changes: 0 additions & 19 deletions .github/workflows/gradle_build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ echo "Copying artifact to ${OUTPUT}/dist"
[[ "$SNAPSHOT" == "true" ]] && IDENTIFIER="-SNAPSHOT"
ARTIFACT_BUILD_NAME=`ls distribution/$TYPE/$TARGET/build/distributions/ | grep "opensearch-min.*$SUFFIX.$EXT"`
# [WAZUH] Used by the GH workflow to upload the artifact
echo "$ARTIFACT_BUILD_NAME" >> "$OUTPUT/artifact_name.txt"
echo "$ARTIFACT_BUILD_NAME" > "$OUTPUT/artifact_name.txt"
mkdir -p "${OUTPUT}/dist"
cp distribution/$TYPE/$TARGET/build/distributions/$ARTIFACT_BUILD_NAME "${OUTPUT}"/dist/$ARTIFACT_BUILD_NAME

Expand Down

0 comments on commit 7da1c0e

Please sign in to comment.