perf(Add-On): Update AOB to 4.2.0 #338
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- beta | |
- alpha | |
- '[0-9]+.x' | |
- '[0-9]+.[0-9]+.x' | |
jobs: | |
appinspect-addon: | |
name: AppInspect (Add-on) | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build Add-on | |
id: build-addon | |
run: scripts/build.sh -a addon | |
- name: Save Add-on Build Artifact | |
uses: actions/upload-artifact@v1 | |
if: '! cancelled()' | |
with: | |
name: Splunk_TA_paloalto-${{ github.run_id }} | |
path: ${{ steps.build-addon.outputs.path }} | |
- name: AppInspect | |
run: scripts/appinspect.sh -a addon -r | |
env: | |
SPLUNK_USER: ${{ secrets.SPLUNK_USER }} | |
SPLUNK_PASS: ${{ secrets.SPLUNK_PASS }} | |
- name: Save report | |
uses: actions/upload-artifact@v1 | |
if: '! cancelled()' | |
with: | |
name: Report-Splunk_TA_paloalto-${{ github.run_id }}.html | |
path: _build/Splunk_TA_paloalto-${{ github.run_id }}.html | |
appinspect-app: | |
name: AppInspect (App) | |
runs-on: ubuntu-20.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build App | |
id: build-app | |
run: scripts/build.sh -a app | |
- name: Save App Build Artifact | |
uses: actions/upload-artifact@v1 | |
if: '! cancelled()' | |
with: | |
name: SplunkforPaloAltoNetworks-${{ github.run_id }} | |
path: ${{ steps.build-app.outputs.path }} | |
- name: AppInspect | |
run: scripts/appinspect.sh -a app -r | |
env: | |
SPLUNK_USER: ${{ secrets.SPLUNK_USER }} | |
SPLUNK_PASS: ${{ secrets.SPLUNK_PASS }} | |
- name: Save report | |
uses: actions/upload-artifact@v1 | |
if: '! cancelled()' | |
with: | |
name: Report-SplunkforPaloAltoNetworks-${{ github.run_id }}.html | |
path: _build/SplunkforPaloAltoNetworks-${{ github.run_id }}.html | |
release: | |
name: Release | |
if: github.ref != 'refs/heads/develop' | |
needs: [appinspect-addon, appinspect-app] | |
runs-on: ubuntu-20.04 | |
outputs: | |
new_release_published: ${{ steps.semantic.outputs.new_release_published }} | |
new_release_version: ${{ steps.semantic.outputs.new_release_version }} | |
new_release_channel: ${{ steps.semantic.outputs.new_release_channel }} | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Create release and publish | |
id: semantic | |
uses: cycjimmy/semantic-release-action@v3 | |
with: | |
semantic_version: 19.0.5 | |
extra_plugins: | | |
conventional-changelog-conventionalcommits@^5.0.0 | |
@semantic-release/exec@^6.0.3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SPLUNK_USER: ${{ secrets.SPLUNK_USER }} | |
SPLUNK_PASS: ${{ secrets.SPLUNK_PASS }} | |
docker-build: | |
name: Docker Build | |
needs: [release] | |
# When to run, per https://github.com/actions/runner/issues/491#issuecomment-850884422 | |
if: always() && (needs.release.result == 'success' || needs.release.result == 'skipped') | |
runs-on: ubuntu-20.04 | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository_owner }}/splunk-demo | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Determine docker tags and labels | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# On a release, tag with 'latest' and semantic versions (eg v3.2.1, v3.2, and v3) | |
tags: | | |
type=ref,event=branch | |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }} | |
type=semver,pattern=v{{version}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }} | |
type=semver,pattern=v{{major}}.{{minor}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }} | |
type=semver,pattern=v{{major}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }} | |
type=semver,pattern=v{{version}},value=${{ needs.release.outputs.new_release_version }},enable=${{ github.ref == 'refs/heads/master' && needs.release.result == 'success' }} | |
- name: Set the version in app.conf | |
if: needs.release.result == 'success' && needs.release.outputs.new_release_published == 'true' | |
run: scripts/set-version.sh ${{ needs.release.outputs.new_release_version }} ${{ needs.release.outputs.new_release_channel }} | |
- name: Login to Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: demo/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |