|
1 |
| -name: Build slim packages |
| 1 | +name: Build packages |
2 | 2 |
|
3 | 3 | # This workflow runs when any of the following occur:
|
4 |
| - # - Run manually |
| 4 | +# - Run manually |
5 | 5 | on:
|
6 | 6 | workflow_dispatch:
|
7 |
| - |
8 |
| - |
9 |
| -# Used to run locally using https://github.com/nektos/act |
10 |
| -env: |
11 |
| - ACT: |
12 |
| - VERSION: 2.11.0 |
13 |
| - SNAPSHOT: false |
14 |
| - PLATFORM: linux |
15 |
| - BUILD: bash scripts/build.sh |
16 |
| - |
| 7 | + inputs: |
| 8 | + revision: |
| 9 | + # description: |
| 10 | + default: "1" |
| 11 | + required: false |
| 12 | + type: string |
| 13 | + |
| 14 | +# ========================== |
| 15 | +# Bibliography |
| 16 | +# ========================== |
| 17 | +# |
| 18 | +# * Reusable workflows: limitations |
| 19 | +# | https://docs.github.com/en/actions/using-workflows/reusing-workflows#limitations |
| 20 | +# * Using matrix in reusable workflows: |
| 21 | +# | https://docs.github.com/en/actions/using-workflows/reusing-workflows#using-a-matrix-strategy-with-a-reusable-workflow |
| 22 | +# * Reading input from the called workflow |
| 23 | +# | https://docs.github.com/en/enterprise-cloud@latest/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_callinputs |
17 | 24 |
|
18 | 25 | jobs:
|
| 26 | + version: |
| 27 | + uses: ./.github/workflows/r_version.yml |
| 28 | + |
19 | 29 | build:
|
20 |
| - runs-on: ubuntu-latest |
21 |
| - # Permissions to upload the package |
22 |
| - permissions: |
23 |
| - packages: write |
24 |
| - contents: read |
| 30 | + needs: version |
25 | 31 | strategy:
|
26 |
| - matrix: |
27 |
| - # act is resource-heavy. Avoid running parallel builds with it: |
28 |
| - # DISTRIBUTION: [ rpm ] |
29 |
| - # ARCHITECTURE: [ x64 ] |
30 |
| - DISTRIBUTION: [ tar, rpm, deb ] |
31 |
| - ARCHITECTURE: [ x64, arm64 ] |
32 |
| - steps: |
33 |
| - - uses: actions/checkout@v4 |
34 |
| - - uses: actions/setup-java@v3 |
35 |
| - with: |
36 |
| - distribution: temurin |
37 |
| - java-version: 11 |
38 |
| - |
39 |
| - - name: Setup Gradle |
40 |
| - |
41 |
| - |
42 |
| - - name: Execute build script |
43 |
| - run: | |
44 |
| - $BUILD -v $VERSION -s $SNAPSHOT -p $PLATFORM -a ${{ matrix.ARCHITECTURE }} -d ${{ matrix.DISTRIBUTION }} |
45 |
| -
|
46 |
| - # The package name is stored in the artifacts/artifact_name.txt file |
47 |
| - - name: Read package name |
48 |
| - id: package_name |
49 |
| - run: | |
50 |
| - echo $(ls -la) |
51 |
| - echo "package_name=$(cat artifacts/artifact_name.txt)" >> $GITHUB_OUTPUT |
52 |
| - echo "$(cat artifacts/artifact_name.txt)" |
53 |
| -
|
54 |
| - - name: Upload artifact |
55 |
| - uses: actions/upload-artifact@v3 |
56 |
| - with: |
57 |
| - name: ${{ steps.package_name.outputs.package_name }} |
58 |
| - path: artifacts/dist/${{ steps.package_name.outputs.package_name }} |
59 |
| - if-no-files-found: error |
60 |
| - |
61 |
| - # assemble: |
62 |
| - # release: |
| 32 | + matrix: |
| 33 | + distribution: [tar, rpm, deb] |
| 34 | + architecture: [x64, arm64] |
| 35 | + uses: ./.github/workflows/r_build.yml |
| 36 | + with: |
| 37 | + architecture: ${{ matrix.architecture }} |
| 38 | + distribution: ${{ matrix.distribution }} |
| 39 | + name: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }} |
| 40 | + # wazuh-indexer-min_4.8.0-rc1_x64_ff98475f.deb |
| 41 | + # TODO arm64 != amd64 (deb), x64 != x86_64 (rpm) |
| 42 | + # TODO use short SHA https://stackoverflow.com/a/59819441/13918537 |
| 43 | + |
| 44 | + assemble: |
| 45 | + needs: [version, build] |
| 46 | + strategy: |
| 47 | + matrix: |
| 48 | + distribution: [tar, rpm, deb] |
| 49 | + architecture: [x64, arm64] |
| 50 | + exclude: |
| 51 | + # skip arm64 until we have arm runners |
| 52 | + - architecture: arm64 |
| 53 | + - distribution: [tar, deb] # Exclude deb assembly until it's implemented |
| 54 | + |
| 55 | + uses: ./.github/workflows/r_assemble.yml |
| 56 | + with: |
| 57 | + architecture: ${{ matrix.architecture }} |
| 58 | + distribution: ${{ matrix.distribution }} |
| 59 | + min: wazuh-indexer-min_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }} |
| 60 | + name: wazuh-indexer_${{ needs.version.outputs.version }}-${{ inputs.revision }}-${{ matrix.architecture }}_${{ github.sha }}.${{ matrix.distribution }} |
0 commit comments