name: plugins concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true on: workflow_dispatch: pull_request: paths: - '.github/workflows/plugins.yml' - 'src/**' - 'packaging/**' push: branches: - develop - master paths: - '.github/workflows/plugins.yml' - 'src/**' - 'packaging/**' tags: - centreon-plugins-* jobs: get-environment: uses: ./.github/workflows/get-environment.yml get-plugins: runs-on: ubuntu-22.04 outputs: plugins: ${{ steps.get_plugins.outputs.plugins }} steps: - uses: actions/checkout@v3 with: fetch-depth: 0 - uses: actions/setup-python@v4 with: python-version: '3.9' - uses: dorny/paths-filter@v2 id: filter with: base: ${{ github.ref }} list-files: shell filters: | common: - added|deleted|modified: src/centreon/** packages: - added|modified: packaging/** plugins: - added|modified: src/** - name: transform to directories run: | folders=() for f in ${{ steps.filter.outputs.packages_files }}; \ do \ echo "Adding $(dirname $f) to folders"; \ folders+=($(dirname $f)); \ done unique_folders=($(printf "%s\n" "${folders[@]}" | sort -u | tr '\n' ' ')) jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_folders[@]} > package_directories.txt files=() for f in ${{ steps.filter.outputs.plugins_files }}; \ do \ echo "Adding $f to files"; \ files+=($f); \ done unique_files=($(printf "%s\n" "${files[@]}" | sort -u | tr '\n' ' ')) jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_files[@]} > plugins.txt shell: bash - name: Get plugins for build id: get_plugins if: ${{ steps.filter.outputs.common == 'true' || steps.filter.outputs.packages == 'true' || steps.filter.outputs.plugins == 'true' }} run: | PLUGINS="$(python3 .github/scripts/process-plugins.py '${{ steps.filter.outputs.common == 'true' }}')" echo "plugins=$(echo $PLUGINS)" >> $GITHUB_OUTPUT if [ "$PLUGINS" == '' ]; then echo "::notice::There are no modifications to the plugins packages" fi shell: bash package: if: ${{ needs.get-plugins.outputs.plugins != '' }} needs: [get-environment, get-plugins] uses: ./.github/workflows/plugin-package.yml with: plugins: ${{ needs.get-plugins.outputs.plugins }} version: ${{ needs.get-environment.outputs.version }} release: ${{ needs.get-environment.outputs.release }} secrets: registry_username: ${{ secrets.DOCKER_REGISTRY_ID }} registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} deliver: needs: [get-environment, package] if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }} uses: ./.github/workflows/plugin-delivery.yml with: version: ${{ needs.get-environment.outputs.version }} release: ${{ needs.get-environment.outputs.release }} stability: ${{ needs.get-environment.outputs.stability }} secrets: nexus_username: ${{ secrets.NEXUS_USERNAME }} nexus_password: ${{ secrets.NEXUS_PASSWORD }} update_repo_path: ${{ secrets.UPDATE_REPO_PATH }} cloudfront_id: ${{ secrets.CLOUDFRONT_ID }} yum_repo_address: ${{ secrets.YUM_REPO_ADDRESS }} yum_repo_key: ${{ secrets.YUM_REPO_KEY }} artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }} token_download_centreon_com: ${{ secrets.TOKEN_DOWNLOAD_CENTREON_COM }}