Skip to content

Commit a83d664

Browse files
authored
ci:major updates to the workflow (#7)
* ci:added pipelines to release and bump * chore(bumpversion):disabled tagging * chore:added changelog file * ci:removed manual release pipeline * ci(ci):changed trigger to PR --------- Co-authored-by: Erica Pescio <[email protected]>
1 parent a1f0c12 commit a83d664

File tree

6 files changed

+172
-185
lines changed

6 files changed

+172
-185
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[bumpversion]
22
current_version = 2.4.1
33
commit = True
4-
tag = True
4+
tag = False
55

66
[bumpversion:file:app.manifest]
77
search = "version": "{current_version}"

.github/workflows/bumpversion.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Bump Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
bumpPart:
7+
description: 'Bump part (major, minor or patch)'
8+
required: true
9+
default: "minor"
10+
11+
jobs:
12+
bump:
13+
name: Bump App Version
14+
runs-on: ubuntu-latest
15+
# Sanity check on the input
16+
if: contains(['major', 'minor', 'patch'], ${{ github.event.inputs.bumpPart }})
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Bump version
20+
id: bumpversion
21+
uses: jasonamyers/[email protected]
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
DEFAULT_BUMP: ${{ github.event.inputs.bumpPart }}
25+
- name: Push
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
remote_repo="https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
30+
git push "$remote_repo" HEAD:"${GITHUB_REF#refs/heads/}"

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
name: CI
22

33
on:
4-
push:
5-
paths-ignore:
6-
- '.github/workflows/manual-release.yml'
4+
pull_request:
5+
paths:
6+
- 'packages/**'
7+
branches:
8+
- master
9+
types: [opened, reopened, synchronize]
710

811
jobs:
912
bundle-app:

.github/workflows/manual-release.yml

Lines changed: 0 additions & 181 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Release from Changelog
2+
3+
on:
4+
push:
5+
paths:
6+
- "CHANGELOG.md"
7+
branches:
8+
- master
9+
10+
# Grants permission to create releases
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
build:
16+
name: Bundle the App
17+
runs-on: ubuntu-latest
18+
outputs:
19+
ta_version: ${{ steps.app.outputs.version }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Get App Info
23+
id: app
24+
run: |
25+
MANIFEST="splunk*/app.manifest"
26+
if [ -f "$MANIFEST" ]; then
27+
app_id=$(cat "$MANIFEST" | jq -r '.info.id.name')
28+
app_version=$(cat "$MANIFEST" | jq -r '.info.id.version')
29+
echo "name=${app_id}" >> $GITHUB_OUTPUT
30+
echo "version=${app_version}" >> $GITHUB_OUTPUT
31+
else
32+
echo "Files Not Found ❌ Please add 'packages/$MANIFEST'"
33+
exit 1
34+
fi
35+
working-directory: ./packages
36+
37+
- name: Bundle app source
38+
env:
39+
APP_NAME: ${{ steps.app.outputs.name }}
40+
APP_VERSION: ${{ steps.app.outputs.version }}
41+
run: |
42+
# Exclude images from README file
43+
sed -i '/^!/d' README.md
44+
cp README.md packages/$APP_NAME
45+
tar -C packages -zcvf $APP_NAME-$APP_VERSION.tar.gz $APP_NAME/
46+
47+
- uses: actions/upload-artifact@v4
48+
with:
49+
name: packaged_app
50+
path: ${{ steps.app.outputs.name }}*.tar.gz
51+
52+
release:
53+
name: Upload Release
54+
runs-on: ubuntu-latest
55+
needs: build
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: actions/download-artifact@v4
59+
with:
60+
name: packaged_app
61+
path: dist
62+
- name: Fetch latest release info from CHANGELOG
63+
id: changelog
64+
uses: release-flow/keep-a-changelog-action@v3
65+
with:
66+
command: query
67+
version: latest
68+
- name: Validate version consistency
69+
env:
70+
VERSION: ${{ steps.changelog.outputs.version }}
71+
TA_VERSION: ${{ needs.build.outputs.ta_version }}
72+
run: |
73+
if [ "$VERSION" != "$TA_VERSION" ]; then
74+
echo "❌ Add-On and Changelog version mismatch. Did you forget to bump the Add-On version?"
75+
exit 1
76+
fi
77+
- name: Create GitHub release
78+
env:
79+
VERSION: v${{ steps.changelog.outputs.version }}
80+
RELEASE_NOTES: ${{ steps.changelog.outputs.release-notes }}
81+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
run: |
83+
LATEST_RELEASE=$(gh release view --json tagName --jq '.tagName')
84+
if [ "$VERSION" == "$LATEST_RELEASE" ]; then
85+
echo "Versions match nothing to do!"
86+
else
87+
echo "Releasing $VERSION"
88+
gh release create $VERSION \
89+
--title "$VERSION" \
90+
--notes "$RELEASE_NOTES" \
91+
dist/*.tar.gz
92+
fi

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
5+
6+
7+
## [v2.4.1] - 2024-04-03
8+
9+
### Changed
10+
11+
- Updated dependencies.
12+
- Updated CI/CD pipelines.
13+
14+
## [v2.4.0] - 2021-09-30
15+
16+
### Added
17+
18+
- Added NOTICE file.
19+
20+
### Fixed
21+
22+
- Compliance with Splunkbase submission request.
23+
24+
## [v2.3.0] - 2021-09-06
25+
26+
### Added
27+
28+
- Compliancy with cloud vetting report.
29+
- Dashboard to showcase visualizations.
30+
31+
### Changed
32+
33+
- Updated dependencies.
34+
35+
## [v2.2.0] - 2019-06-2017
36+
37+
### Added
38+
39+
- Multiple axes visualization.
40+
41+
### Changed
42+
43+
- Minor changes to the OHLC dark mode visualization style.

0 commit comments

Comments
 (0)