-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
6 additions
and
74 deletions.
There are no files selected for viewing
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
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 }} |