diff --git a/.github/actions/release-sources/action.yml b/.github/actions/release-sources/action.yml new file mode 100644 index 000000000..d414ea676 --- /dev/null +++ b/.github/actions/release-sources/action.yml @@ -0,0 +1,44 @@ +name: "release-sources" +description: "Release sources on download.centreon.com" +inputs: + bucket_directory: + description: The bucket directory + required: true + module_directory: + description: The module directory + required: true + module_name: + description: The module name + required: true + version: + description: The module version + required: true + release: + description: The module release + required: true + token_download_centreon_com: + description: The token to call download.centreon.com api + required: true + +runs: + using: "composite" + steps: + - name: Setup awscli + run: | + curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + sudo unzip -q awscliv2.zip + sudo ./aws/install + shell: bash + + - run: | + SRC_FILE="${{ inputs.module_name }}-${{ inputs.version }}.tar.gz" + + mv "${{ inputs.module_directory }}" "${{ inputs.module_name }}-${{ inputs.version }}" + tar czf $SRC_FILE "${{ inputs.module_name }}-${{ inputs.version }}" + + SRC_HASH=$(md5sum $SRC_FILE | cut -d ' ' -f 1) + SRC_SIZE=$(stat -c '%s' $SRC_FILE) + + aws s3 cp --acl public-read "$SRC_FILE" "s3://centreon-download/public/${{ inputs.bucket_directory }}/$SRC_FILE" + curl --fail "https://download.centreon.com/api/?token=${{ inputs.token_download_centreon_com }}&product=${{ inputs.module_name }}&release=${{ inputs.release }}&version=${{ inputs.version }}&extension=tar.gz&md5=$SRC_HASH&size=$SRC_SIZE&ddos=0&dryrun=0" + shell: bash diff --git a/.github/workflows/plugin-delivery.yml b/.github/workflows/plugin-delivery.yml index b01065317..66fbc7541 100644 --- a/.github/workflows/plugin-delivery.yml +++ b/.github/workflows/plugin-delivery.yml @@ -1,6 +1,14 @@ on: workflow_call: inputs: + version: + description: The package version + type: string + required: true + release: + description: The package release + type: string + required: true stability: description: The package stability (stable, testing, unstable) type: string @@ -25,8 +33,34 @@ on: artifactory_token: description: "The artifactory token" required: true + token_download_centreon_com: + description: "The token to call download.centreon.com api" + required: true jobs: + deliver-sources: + runs-on: [self-hosted, common] + if: ${{ contains(fromJson('["stable"]'), inputs.stability) }} + + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - uses: actions/cache@v3 + with: + path: ./build/ + key: fatpacked-plugins-${{ github.sha }}-${{ github.run_id }} + + - name: Deliver sources + uses: ./.github/actions/release-sources + with: + bucket_directory: centreon-plugins + module_directory: build + module_name: centreon-plugins + version: ${{ inputs.version }} + release: ${{ inputs.release }} + token_download_centreon_com: ${{ secrets.token_download_centreon_com }} + deliver-rpm: runs-on: [self-hosted, common] strategy: diff --git a/.github/workflows/plugins.yml b/.github/workflows/plugins.yml index ca72b52c8..850d3c166 100644 --- a/.github/workflows/plugins.yml +++ b/.github/workflows/plugins.yml @@ -103,6 +103,8 @@ jobs: 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 }} @@ -112,3 +114,4 @@ jobs: 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 }}