forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test new approach using reusable worfklows
- Loading branch information
Showing
4 changed files
with
179 additions
and
27 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Assemble (reusable) | ||
|
||
# This workflow runs when any of the following occur: | ||
# - Run from another workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
distribution: | ||
description: 'One of [ "tar", "rpm", "deb" ]' | ||
default: 'rpm' | ||
required: false | ||
type: string | ||
architecture: | ||
description: 'One of [ "x64", "arm64" ]' | ||
default: 'x64' | ||
required: false | ||
type: string | ||
package: | ||
required: true | ||
type: string | ||
# outputs: | ||
# package: | ||
# description: "The package's name" | ||
# value: ${{ jobs.build.outputs.package }} | ||
|
||
|
||
jobs: | ||
build: | ||
# runs-on: ${{ inputs.architecture }} | ||
runs-on: ubuntu-latest | ||
# Permissions to upload the package | ||
permissions: | ||
packages: write | ||
contents: read | ||
# outputs: | ||
# package: ${{ steps.get_name.outputs.name }} | ||
steps: | ||
- name: Read artifacts | ||
run: | | ||
ls -l ./artifacts/dist | ||
- name: Download artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.package }} | ||
path: ${{ inputs.architecture }}/${{ inputs.distribution }} | ||
|
||
# - name: Run `assemble.sh` | ||
# run: | | ||
# bash scripts/assemble.sh -v ${{ vars.OPENSEARCH_VERSION }} -p linux -a ${{ inputs.architecture }} -d ${{ inputs.distribution }} | ||
|
||
# # The package name is stored in the artifacts/artifact_name.txt file. | ||
# # The variable name is generated dynamically: rpm_x64 | ||
# - name: Set package name | ||
# id: get_name | ||
# run: | | ||
# echo $(ls -la) | ||
# # ${{ inputs.distribution }}_${{ inputs.architecture }} | ||
# echo "name=$(cat artifacts/artifact_name.txt)" >> $GITHUB_OUTPUT | ||
# echo "$(cat artifacts/artifact_name.txt)" | ||
|
||
# - name: Upload artifact | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: ${{ steps.get_name.outputs.name }} | ||
# path: ${{ inputs.architecture }}/${{ inputs.distribution }} | ||
# if-no-files-found: error | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Build (reusable) | ||
|
||
# This workflow runs when any of the following occur: | ||
# - Run from another workflow | ||
on: | ||
workflow_call: | ||
inputs: | ||
distribution: | ||
description: 'One of [ "tar", "rpm", "deb" ]' | ||
default: 'rpm' | ||
required: false | ||
type: string | ||
architecture: | ||
description: 'One of [ "x64", "arm64" ]' | ||
default: 'x64' | ||
required: false | ||
type: string | ||
outputs: | ||
package: | ||
description: "The package's name" | ||
value: ${{ jobs.build.outputs.package }} | ||
|
||
# TODO version must to be read from the VERSION file | ||
# TODO revision must be an input | ||
env: | ||
version: 4.9.0 | ||
revision: 1 | ||
|
||
jobs: | ||
build: | ||
# runs-on: ${{ inputs.architecture }} | ||
runs-on: ubuntu-latest | ||
# Permissions to upload the package | ||
permissions: | ||
packages: write | ||
contents: read | ||
outputs: | ||
package: ${{ steps.get_name.outputs.name }} | ||
steps: | ||
- name: Run `build.sh` | ||
run: | | ||
bash scripts/build.sh -v ${{ vars.OPENSEARCH_VERSION }} -s false -p linux -a ${{ inputs.architecture }} -d ${{ inputs.distribution }} | ||
# The package name is stored in the artifacts/artifact_name.txt file. | ||
# The variable name is generated dynamically: rpm_x64 | ||
- name: Set package name | ||
id: get_name | ||
run: | | ||
echo $(ls -la) | ||
# ${{ inputs.distribution }}_${{ inputs.architecture }} | ||
echo "name=$(cat artifacts/artifact_name.txt)" >> $GITHUB_OUTPUT | ||
echo "$(cat artifacts/artifact_name.txt)" | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
# name: wazuh-indexer-min_${{ env.version }}-${{ env.revision }}_${{ inputs.architecture }}_${{ github.sha }}.${{ inputs.distribution }} | ||
# example: x64/deb/wazuh-indexer_4.8.0-rc1_x64_ff98475f.deb | ||
# TODO x64 -> deb: amd64, rpm: x86_64 | ||
name: ${{ steps.get_name.outputs.name }} | ||
path: ${{ inputs.architecture }}/${{ inputs.distribution }} | ||
if-no-files-found: error | ||
|
||
|
||
|
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