Skip to content

Commit c590498

Browse files
Merge pull request #128 from quotentiroler/dev/update
πŸ”„ Auto-PR: Merge `dev/update` β†’ `develop`
2 parents 0603c42 + fb8ea13 commit c590498

14 files changed

Lines changed: 413 additions & 5260 deletions

β€Ž.github/actions/setup-bun-version/action.ymlβ€Ž

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ runs:
4141
uses: actions/setup-node@v4
4242
with:
4343
node-version: ${{ inputs.node-version }}
44-
cache: 'npm'
45-
cache-dependency-path: '**/package-lock.json'
4644

4745
- name: Setup Bun
4846
uses: oven-sh/setup-bun@v2

β€Ž.github/actions/setup-node-ai/action.ymlβ€Ž

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,15 @@ runs:
2828
uses: actions/setup-node@v4
2929
with:
3030
node-version: ${{ inputs.node-version }}
31-
cache: 'npm'
31+
32+
- name: Setup Bun
33+
uses: oven-sh/setup-bun@v2
34+
with:
35+
bun-version: latest
3236

3337
- name: Install AI dependencies
3438
shell: bash
35-
env:
36-
NPM_CONFIG_LOGLEVEL: error
37-
NPM_CONFIG_FUND: false
38-
NPM_CONFIG_AUDIT: false
3939
run: |
40-
# Install specific versions to avoid deprecated dependency warnings
41-
# Suppress output to avoid cluttering CI logs with deprecation warnings
42-
npm install openai@latest @octokit/rest@latest --silent 2>/dev/null || {
43-
echo "⚠️ Installation had warnings, but dependencies are available"
44-
npm install openai@latest @octokit/rest@latest --no-fund --no-audit
45-
}
46-
47-
echo "βœ… Installed AI dependencies (OpenAI + Octokit)"
40+
# Install AI dependencies using Bun for consistency
41+
bun add openai@latest @octokit/rest@latest
42+
echo "βœ… Installed AI dependencies (OpenAI + Octokit) using Bun"

β€Ž.github/workflows/production-release.ymlβ€Ž

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,15 @@ jobs:
3636
echo "Changed files:"
3737
echo "$CHANGED_FILES"
3838
39-
# Define documentation-only patterns
39+
# Define documentation-only patterns and workflow patterns
4040
DOC_PATTERNS="README\.md|\.md$|docs/|LICENSE|CHANGELOG"
41+
WORKFLOW_PATTERNS="\.github/workflows/"
4142
42-
# Check if only documentation files were changed
43-
NON_DOC_CHANGES=$(echo "$CHANGED_FILES" | grep -vE "$DOC_PATTERNS" || true)
43+
# Check if only documentation files or workflow files were changed
44+
NON_CODE_CHANGES=$(echo "$CHANGED_FILES" | grep -vE "$DOC_PATTERNS|$WORKFLOW_PATTERNS" || true)
4445
45-
if [ -z "$NON_DOC_CHANGES" ]; then
46-
echo "Only documentation files changed, skipping production release"
46+
if [ -z "$NON_CODE_CHANGES" ]; then
47+
echo "Only documentation or workflow files changed, skipping production release"
4748
echo "should_release=false" >> $GITHUB_OUTPUT
4849
else
4950
echo "Code changes detected, proceeding with production release"
@@ -107,30 +108,43 @@ jobs:
107108
108109
- name: Revert to previous commit
109110
run: |
110-
echo "🚨 Production release failed - reverting main branch to previous commit"
111+
echo "🚨 Production release failed - creating revert commit"
111112
112-
# Reset to the previous commit (HEAD~1)
113-
git reset --hard HEAD~1
113+
# Get the commit hash we want to revert to
114+
PREVIOUS_COMMIT=$(git rev-parse HEAD~1)
115+
echo "Previous commit: $PREVIOUS_COMMIT"
114116
115-
# Force push the revert
116-
git push origin main --force
117+
# Create a revert commit instead of force pushing
118+
git revert --no-edit HEAD
117119
118-
echo "βœ… Successfully reverted main branch to previous commit"
120+
# Push the revert commit (this respects branch protection rules)
121+
git push origin main
119122
120-
# Create an issue to track the failed release
121-
gh issue create \
122-
--title "🚨 Production Release Failed - Main Branch Reverted" \
123-
--body "**Production release pipeline failed and main branch has been automatically reverted.**
123+
echo "βœ… Successfully created revert commit for failed production release"
124+
125+
# Create a PR from test branch to track the failed release and retry
126+
gh pr create \
127+
--title "οΏ½ RETRY: Production Release Failed - Using Test Branch" \
128+
--body "**Production release pipeline failed and a revert commit has been created.**
124129
125130
**Details:**
126-
- Reverted to previous commit (HEAD~1)
131+
- Revert commit: \`$(git rev-parse HEAD)\`
132+
- Failed commit: \`$(git rev-parse HEAD~1)\`
127133
- Failed workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
128134
- Timestamp: $(date -u)
129135
136+
**What happened:**
137+
The production release pipeline failed, so the changes have been reverted from main.
138+
130139
**Next Steps:**
131140
1. Investigate the release failure in the workflow logs
132-
2. Fix any issues that caused the release to fail
133-
3. Re-run the production release when ready" \
134-
--label "bug,release-failure,high-priority"
141+
2. Fix any issues that caused the release to fail in the test branch
142+
3. Re-test the changes thoroughly
143+
4. Merge this PR when ready to retry the production release
144+
145+
**This PR uses the test branch to retry the failed production release.**" \
146+
--base main \
147+
--head "test" \
148+
--label "retry,release-failure,high-priority"
135149
env:
136150
GH_TOKEN: ${{ steps.generate_token.outputs.token }}

β€Ž.github/workflows/version-operations.ymlβ€Ž

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,26 +123,44 @@ jobs:
123123
- name: Check if version should be bumped (alpha releases only)
124124
id: version_check
125125
if: inputs.operation == 'update' && inputs.release_type == 'alpha'
126+
env:
127+
GH_TOKEN: ${{ steps.generate_token.outputs.token || github.token }}
126128
run: |
127129
# Get current version from current branch
128130
CURRENT_VERSION="${{ steps.check.outputs.current_version }}"
129131
CURRENT_BASE="${{ steps.check.outputs.base_version }}"
130132
131-
# Get version from main branch
132-
git fetch origin main
133-
MAIN_VERSION=$(git show origin/main:package.json | node -p "JSON.parse(require('fs').readFileSync('/dev/stdin', 'utf8')).version")
134-
MAIN_BASE=$(echo "$MAIN_VERSION" | sed 's/-.*$//')
133+
# Get version from latest beta or production release (excluding alpha)
134+
LATEST_RELEASE_TAG=$(gh release list --limit 100 | cut -f3 | grep -E "(RELEASE)" | head -n1 || echo "")
135+
136+
if [ -n "$LATEST_RELEASE_TAG" ]; then
137+
# Extract base version from latest beta/production release tag
138+
LATEST_RELEASE_BASE=$(echo "$LATEST_RELEASE_TAG" | sed 's/^v//' | sed 's/-.*$//')
139+
echo "Found latest beta/production release: $LATEST_RELEASE_TAG (base: $LATEST_RELEASE_BASE)"
140+
else
141+
# No beta/production releases found, use 0.0.0 as baseline
142+
LATEST_RELEASE_BASE="0.0.0"
143+
echo "No beta/production releases found, using baseline: $LATEST_RELEASE_BASE"
144+
fi
135145
136146
echo "current_base=$CURRENT_BASE" >> $GITHUB_OUTPUT
137-
echo "main_base=$MAIN_BASE" >> $GITHUB_OUTPUT
147+
echo "latest_release_base=$LATEST_RELEASE_BASE" >> $GITHUB_OUTPUT
138148
139-
# Check if versions match (meaning we should bump)
140-
if [ "$CURRENT_BASE" = "$MAIN_BASE" ]; then
149+
# Check if current base is same or older than latest release (meaning we should bump)
150+
if [ "$CURRENT_BASE" = "$LATEST_RELEASE_BASE" ]; then
141151
echo "should_bump=true" >> $GITHUB_OUTPUT
142-
echo "βœ… Versions match ($CURRENT_BASE = $MAIN_BASE) - will bump version"
152+
echo "βœ… Current base matches latest release ($CURRENT_BASE = $LATEST_RELEASE_BASE) - will bump version"
143153
else
144-
echo "should_bump=false" >> $GITHUB_OUTPUT
145-
echo "⏭️ Versions differ ($CURRENT_BASE β‰  $MAIN_BASE) - will use current version"
154+
# Use version comparison to check if current is newer
155+
if printf '%s\n%s\n' "$LATEST_RELEASE_BASE" "$CURRENT_BASE" | sort -V | head -n1 | grep -q "^$LATEST_RELEASE_BASE$"; then
156+
if [ "$CURRENT_BASE" != "$LATEST_RELEASE_BASE" ]; then
157+
echo "should_bump=false" >> $GITHUB_OUTPUT
158+
echo "⏭️ Current base is newer than latest release ($CURRENT_BASE > $LATEST_RELEASE_BASE) - will use current version"
159+
fi
160+
else
161+
echo "should_bump=true" >> $GITHUB_OUTPUT
162+
echo "βœ… Current base is older than latest release ($CURRENT_BASE < $LATEST_RELEASE_BASE) - will bump version"
163+
fi
146164
fi
147165
148166
- name: Update versions
@@ -211,9 +229,21 @@ jobs:
211229
case "${{ inputs.release_type }}" in
212230
"alpha")
213231
if [ "${{ inputs.should_bump_version }}" = "true" ] && [ "${{ steps.version_check.outputs.should_bump }}" = "true" ]; then
214-
# Use our bump script to increment patch version
215-
bun run version:bump
216-
NEW_BASE=$(node -p "require('./package.json').version")
232+
# Calculate new base version by bumping the latest release version
233+
LATEST_RELEASE_BASE="${{ steps.version_check.outputs.latest_release_base }}"
234+
235+
# Use Node.js to properly increment the version
236+
NEW_BASE=$(node -e "
237+
const latest = '$LATEST_RELEASE_BASE';
238+
const [major, minor, patch] = latest.split('.').map(Number);
239+
console.log(\`\${major}.\${minor}.\${patch + 1}\`);
240+
")
241+
242+
echo "Bumping from latest release base $LATEST_RELEASE_BASE to $NEW_BASE"
243+
244+
# Set the new base version in all package.json files
245+
bun run version:set "$NEW_BASE"
246+
217247
NEW_VERSION="${NEW_BASE}-${VERSION_SUFFIX}.${BUILD_NUMBER}.${RELEASE_SHA}"
218248
else
219249
NEW_VERSION="${BASE_VERSION}-${VERSION_SUFFIX}.${BUILD_NUMBER}.${RELEASE_SHA}"

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ A comprehensive healthcare application platform implementing SMART App Launch Fr
44

55
**Proxy smart, not hard!** πŸš€
66

7-
[![Version](https://img.shields.io/badge/v0.0.1-RELEASE-blue.svg)](https://github.com/quotentiroler/proxy-smart)
7+
[![Version](https://img.shields.io/badge/v0.0.1-alpha-blue.svg)](https://github.com/quotentiroler/proxy-smart)
88
[![SMART App Launch](https://img.shields.io/badge/SMART%20App%20Launch-2.2.0-green.svg)](http://hl7.org/fhir/smart-app-launch/)
99
[![FHIR](https://img.shields.io/badge/FHIR-R4%2FR4B-orange.svg)](https://hl7.org/fhir/R4/)
1010
[![Node.js](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)

β€Žbackend/.env.exampleβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Base URL for your SMART proxy
1+
# Base URL for the proxy
22
BASE_URL=http://localhost:8445
33

44
# Keycloak configuration

β€Žbackend/src/routes/admin/keycloak-config.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function updateConfiguration(keycloakConfig: KeycloakConfig): void {
6161
const lines: string[] = []
6262

6363
// Add header comment
64-
lines.push('# Base URL for your SMART proxy')
64+
lines.push('# Base URL for the proxy')
6565
if (envVars.has('BASE_URL')) {
6666
lines.push(`BASE_URL=${envVars.get('BASE_URL')}`)
6767
}

0 commit comments

Comments
Β (0)