diff --git a/.github/workflows/reusable-publish-to-splunkbase.yml b/.github/workflows/reusable-publish-to-splunkbase.yml new file mode 100644 index 00000000..2ad434ef --- /dev/null +++ b/.github/workflows/reusable-publish-to-splunkbase.yml @@ -0,0 +1,58 @@ +name: publish-to-splunkbase +on: + workflow_call: + inputs: + addon_version: + description: 'The version of the add-on to publish to Splunkbase' + required: true + type: string + splunk_versions: + description: 'Comma-separated list of supported Splunk versions' + required: true + type: string + cim_versions: + description: 'Comma-separated list of supported CIM versions' + required: true + type: string + secrets: + SPL_COM_USERNAME: + description: 'Splunk Community username' + required: true + SPL_COM_PASSWORD: + description: 'Splunk Community password' + required: true + +jobs: + inputs-validator: + runs-on: ubuntu-latest + steps: + - id: matrix + uses: splunk/addonfactory-test-matrix-action@v3.1 + with: + features: PYTHON39 + publish: + runs-on: ubuntu-latest + needs: + - inputs-validator + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - run: pip install splunk_add_on_ucc_framework-5.69.1-py3-none-any.whl + - name: Fetch build + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release download v${{ inputs.addon_version }} --pattern "*${{ inputs.addon_version }}.spl" --output release.spl + - run: | + APP_ID=$(cat .splunkbase) + export APP_ID + ucc-gen publish \ + --stage \ + --app-id "$APP_ID" \ + --package-path release.spl \ + --splunk-versions ${{ inputs.splunk_versions }} \ + --cim-versions ${{ inputs.cim_versions }} \ + --username ${{ secrets.SPL_COM_USERNAME }} \ + --password ${{ secrets.SPL_COM_PASSWORD }} diff --git a/.github/workflows/reusable-validate-deploy-docs.yml b/.github/workflows/reusable-validate-deploy-docs.yml new file mode 100644 index 00000000..7d721df7 --- /dev/null +++ b/.github/workflows/reusable-validate-deploy-docs.yml @@ -0,0 +1,61 @@ +name: validate-deploy-docs + +on: + workflow_call: + +jobs: + validate-docs-change: + runs-on: ubuntu-latest + outputs: + status: ${{ steps.validate.outputs.status }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Install mkdocs and plugins + run: pip install mkdocs==1.6.0 mkdocs-material==9.5.32 mkdocs-print-site-plugin==2.6.0 + - name: Validate docs change + id: validate + shell: bash + run: | + RED='\033[0;31m' + GREEN='\033[0;32m' + NC='\033[0m' + if mkdocs build --strict; then + echo "status=success" >> "$GITHUB_OUTPUT" + echo -e "${GREEN}Docs validation success${NC}" + else + echo "status=failure" >> "$GITHUB_OUTPUT" + echo -e "${RED}Docs validation failure${NC}" + exit 1 + fi + + deploy-docs: + needs: + - validate-docs-change + runs-on: ubuntu-latest + permissions: + contents: write + pages: write + if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.12 + - name: Install mkdocs and plugins + run: pip install mkdocs==1.6.0 mkdocs-material==9.5.32 mkdocs-print-site-plugin==2.6.0 + - name: Build and Deploy docs + id: deploy + shell: bash + run: | + RED='\033[0;31m' + GREEN='\033[0;32m' + NC='\033[0m' + if [ "${{ needs.validate-docs-change.outputs.status }}" == "failure" ]; then + echo -e "${RED}Docs validation failed, abort docs deployment... (for more details look at Validate docs change job)${NC}" + exit 1 + fi + mkdocs gh-deploy --force + echo -e "${GREEN}Deployed docs on github!${NC}"