Skip to content

Commit

Permalink
Update splunkbase-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
diogofgm committed May 8, 2024
1 parent cf8dcc3 commit 485f6e2
Showing 1 changed file with 6 additions and 74 deletions.
80 changes: 6 additions & 74 deletions .github/workflows/splunkbase-release.yml
Original file line number Diff line number Diff line change
@@ -1,77 +1,9 @@
name: Publish to Splunkbase
name: Release to Splunkbase
on: workflow_dispatch
# on:
# push:
# branches:
# - "main"
# tags:
# - "v[0-9]+.[0-9]+.[0-9]+"
# pull_request:
# branches:
# - "main"

jobs:

# Package App
splunkbase-release:
name: Splunkbase release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
# semantic-release won't trigger a tagged build if this is not set false
persist-credentials: false

# Our add-on contains Python code, so we need to install Python in the container
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7

# - name: Package Splunk App with SLIM
# id: slim
# uses: splunk/addonfactory-packaging-toolkit-action@v1.1.1
# with:
# source: /github/workspace/package
- name: Load ENV variables
id: vars
run: |
source .splunkbase
echo ::set-output name=SPLUNKBASE_ID::"$SPLUNKBASE_ID"
echo ::set-output name=SPLUNKBASE_SPLUNK_VERSION::"$SPLUNKBASE_SPLUNK_VERSION"
echo ::set-output name=SPLUNKBASE_SPLUNK_CIM_VERSION::"$SPLUNKBASE_SPLUNK_CIM_VERSION"
- name: Package Splunk App with CLI
run: |
pwd
ls -la
cd ${GITHUB_WORKSPACE}
mv package TA-pinsafe
mkdir dist
tar -zcvf dist/TA-pinsafe.tgz TA-pinsafe
cd dist
ls -la
pwd
- name: Authenticate to Splunkbase
id: login
shell: bash
run: |
curl --location --request POST 'https://splunkbase.splunk.com/api/account:login/' --data-urlencode 'username='"${{ secrets.SPLUNKBASE_USER }}"'' --data-urlencode 'password='"${{ secrets.SPLUNKBASE_PASSWORD }}"'' > login.xml
ls
pwd
AUTH=$(awk '/id/{printf $1}' login.xml | cut -d'>' -f2 | cut -d'<' -f1)
echo ::set-output name=SPLUNKBASE_SESSION_ID::"$AUTH"
- name: Publish to Splunkbase
shell: bash
run: |
cd /home/runner/work/TA-pinsafe/TA-pinsafe/dist
pwd
ls
echo ${{ steps.login.outputs.SPLUNKBASE_SESSION_ID }}
echo ${{ steps.vars.outputs.SPLUNKBASE_ID }}
echo ${{ steps.vars.outputs.SPLUNKBASE_SPLUNK_VERSION }}
echo ${{ steps.vars.outputs.SPLUNKBASE_SPLUNK_CIM_VERSION }}
curl -u ${{ secrets.SPLUNKBASE_USER }}:${{ secrets.SPLUNKBASE_PASSWORD }} --request POST https://splunkbase.splunk.com/api/v1/app/${{ steps.vars.outputs.SPLUNKBASE_ID }}/new_release/ -F "files[]=@/home/runner/work/TA-pinsafe/TA-pinsafe/dist/TA-pinsafe.tgz" -F "filename=TA-pinsafe.tgz" -F "cim_versions=${{ steps.vars.outputs.SPLUNKBASE_SPLUNK_CIM_VERSION }}" -F "splunk_versions=${{ steps.vars.outputs.SPLUNKBASE_SPLUNK_VERSION }}" -F "visibility=true"
publish:
uses: diogofgm/splunkbase-release-action/.github/workflows/splunkbase-release-action.yml@v0.0.3
secrets:
SPLUNKBASE_USER: ${{ secrets.SPLUNKBASE_USER }}
SPLUNKBASE_PASSWORD: ${{ secrets.SPLUNKBASE_PASSWORD }}

0 comments on commit 485f6e2

Please sign in to comment.