chore(ci): publish releases on download.centreon.com (#4340)

Refs: MON-15793
This commit is contained in:
Kevin Duret 2023-04-12 12:01:30 +02:00 committed by GitHub
parent 4f6ab28902
commit 21d6a31eee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 81 additions and 0 deletions

View File

@ -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

View File

@ -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:

View File

@ -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 }}