Skip to content

Commit 8011575

Browse files
Merge pull request #304 from canonical/IAM-1653
ci: release charm library with charm together
2 parents 736a041 + 147b6cd commit 8011575

1 file changed

Lines changed: 38 additions & 6 deletions

File tree

.github/workflows/release_libs.yaml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,48 @@
1-
# Release login_ui_endpoints library only if it has changed
2-
name: Release library
1+
# Release charm's libraries if they have changed
2+
name: Release Charm Library
33

44
on:
55
push:
6-
branches:
7-
- main
8-
paths:
9-
- "lib/charms/identity_platform_login_ui_operator/**"
6+
tags:
7+
- "v**"
108

119
jobs:
10+
filter:
11+
name: Check if charm library changes between tags
12+
runs-on: ubuntu-latest
13+
outputs:
14+
run-release: ${{ steps.check.outputs.run_release }}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Check diff between latest two tags
22+
id: check
23+
run: |
24+
set -e
25+
26+
TAGS=$(git tag --sort=-creatordate | grep "^v" | head -n 2)
27+
LATEST_TAG=$(echo "$TAGS" | sed -n 1p)
28+
PREV_TAG=$(echo "$TAGS" | sed -n 2p)
29+
30+
echo "Latest tag: $LATEST_TAG"
31+
echo "Previous tag: $PREV_TAG"
32+
33+
echo "run_release=false" >> $GITHUB_OUTPUT
34+
35+
if git diff --name-only "$PREV_TAG" "$LATEST_TAG" | grep -q '^lib/charms/identity_platform_login_ui_operator/'; then
36+
echo "Changes found in charm library"
37+
echo "run_release=true" >> $GITHUB_OUTPUT
38+
else
39+
echo "No changes found in charm library"
40+
fi
41+
1242
release-lib:
1343
name: Release any bumped library
44+
needs: filter
45+
if: needs.filter.outputs.run-release == 'true'
1446
uses: canonical/identity-team/.github/workflows/charm-libs-release.yaml@f18247249f506f3c9210b86e43a2c4dd063088c5 # v1.8.7
1547
secrets:
1648
CHARMCRAFT_CREDENTIALS: ${{ secrets.CHARMCRAFT_CREDENTIALS }}

0 commit comments

Comments
 (0)