Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
PSchmiedmayer committed Jan 9, 2025
1 parent 9092567 commit 1fe0835
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 17 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ on:
The semantic version of the app that should be released.
required: true
type: string
releasenotes:
description: |
Release notes of what changed in this version.
required: false
type: string
default: Bug fixes and performance improvements.
workflow_call:
inputs:
environment:
Expand All @@ -42,6 +48,12 @@ on:
The semantic version of the app that should be released.
required: true
type: string
releasenotes:
description: |
Release notes of what changed in this version.
required: false
type: string
default: Bug fixes and performance improvements.

concurrency:
group: deployment
Expand All @@ -61,8 +73,10 @@ jobs:
run: |
if [[ -z "${{ inputs.environment }}" ]]; then
echo "environment=staging" >> $GITHUB_OUTPUT
echo "environment: staging"
else
echo "environment=${{ inputs.environment }}" >> $GITHUB_OUTPUT
echo "environment: ${{ inputs.environment }}"
fi
vars:
name: Inject Environment Variables In Deployment Workflow
Expand Down Expand Up @@ -92,6 +106,7 @@ jobs:
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
echo "version: ${{ inputs.version }}"
fi
echo "releasenotes: ${{ inputs.releasenotes }}"
buildandtest:
name: Build and Test
needs: determineenvironment
Expand All @@ -110,5 +125,5 @@ jobs:
environment: ${{ needs.determineenvironment.outputs.environment }}
googleserviceinfoplistpath: 'ENGAGEHF/Supporting Files/GoogleService-Info.plist'
setupsigning: true
fastlanelane: deploy environment:"${{ needs.determineenvironment.outputs.environment }}" appidentifier:"${{ needs.vars.outputs.appidentifier }}" provisioningProfile:"${{ needs.vars.outputs.provisioningProfileName }}" versionname:"${{ needs.vars.outputs.version }}"
fastlanelane: deploy environment:"${{ needs.determineenvironment.outputs.environment }}" appidentifier:"${{ needs.vars.outputs.appidentifier }}" provisioningProfile:"${{ needs.vars.outputs.provisioningProfileName }}" versionname:"${{ needs.vars.outputs.version }} releasenotes:"${{ inputs.releasenotes }}"
secrets: inherit
34 changes: 19 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ jobs:
formatreleasenotes:
name: Format Release Notes
runs-on: ubuntu-latest
outputs:
releasenotes: ${{ steps.releasenotes.outputs.releasenotes }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Dependencies
run: pip install requests
- name: Fetch and Process Changelog
id: changelog
- name: Fetch and Process releasenotes
id: releasenotes
run: |
python <<EOF
import re
Expand All @@ -44,35 +46,36 @@ jobs:
URL = f"https://api.github.com/repos/{REPO}/releases/tags/{RELEASE_TAG}"
response = requests.get(URL)
release = response.json()
changelog = release.get('body', '')
releasenotes = release.get('body', '')
# Extract only the "What's Changed" section
match = re.search(r"## What's Changed(.*?)(##|$)", changelog, flags=re.DOTALL)
match = re.search(r"## What's Changed(.*?)(##|$)", releasenotes, flags=re.DOTALL)
if match:
changelog = match.group(1).strip()
releasenotes = match.group(1).strip()
else:
changelog = "Bug fixes and performance improvements."
releasenotes = "Bug fixes and performance improvements."
# Remove all Markdown formatting
changelog = re.sub(r'^#+\s*', '', changelog, flags=re.MULTILINE) # Remove headers
changelog = re.sub(r'\*\*|__|\*|_', '', changelog) # Remove bold, italics, etc.
changelog = re.sub(r'\[(.*?)\]\((.*?)\)', r'\1', changelog) # Remove links but keep text
changelog = re.sub(r'https://github\.com/[^/]+/[^/]+/pull/(\d+)', r'#\1', changelog) # Shorten pull request URLs
releasenotes = re.sub(r'^#+\s*', '', releasenotes, flags=re.MULTILINE) # Remove headers
releasenotes = re.sub(r'\*\*|__|\*|_', '', releasenotes) # Remove bold, italics, etc.
releasenotes = re.sub(r'\[(.*?)\]\((.*?)\)', r'\1', releasenotes) # Remove links but keep text
releasenotes = re.sub(r'https://github\.com/[^/]+/[^/]+/pull/(\d+)', r'#\1', releasenotes) # Shorten pull request URLs
# Remove excess blank lines
changelog = re.sub(r'\n\s*\n', '\n', changelog).strip()
releasenotes = re.sub(r'\n\s*\n', '\n', releasenotes).strip()
# Write cleaned changelog to GITHUB_OUTPUT
# Write cleaned releasenotes to GITHUB_OUTPUT
with open(os.environ['GITHUB_OUTPUT'], 'a') as output_file:
output_file.write(f"changelog<<EOF\n{changelog}\nEOF\n")
output_file.write(f"releasenotes<<EOF\n{releasenotes}\nEOF\n")
EOF
- name: Formatted Release Notes
run: |
echo "Formatted Release Notes:"
echo "${{ steps.changelog.outputs.changelog }}"
echo "${{ steps.releasenotes.outputs.releasenotes }}"
# build-and-test:
# name: Build and Test
# uses: ./.github/workflows/deployment.yml
# needs: formatreleasenotes
# permissions:
# contents: read
# checks: write
Expand All @@ -81,4 +84,5 @@ jobs:
# secrets: inherit
# with:
# environment: production
# version: ${{ github.event.release.tag_name }}
# version: ${{ github.event.release.tag_name }}
# releasenotes: ${{ needs.formatreleasenotes.outputs.releasenotes }}
8 changes: 7 additions & 1 deletion fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ APP_CONFIG = {
default_environment: "staging",
default_app_identifier: "edu.stanford.bdh.engagehf",
default_provisioningProfile: "Stanford BDHG ENGAGE-HF",
default_version_name: "2.0.1"
default_version_name: "2.0.1",
default_release_notes: "Bug fixes and performance improvements"
}.freeze

platform :ios do
Expand Down Expand Up @@ -130,11 +131,13 @@ platform :ios do
appidentifier = options[:appidentifier].to_s.strip.empty? ? APP_CONFIG[:default_app_identifier] : options[:appidentifier]
provisioningProfile = options[:provisioningProfile].to_s.strip.empty? ? APP_CONFIG[:default_provisioningProfile] : options[:provisioningProfile]
versionname = options[:versionname].to_s.strip.empty? ? APP_CONFIG[:default_version_name] : options[:versionname]
releasenotes = options[:releasenotes].to_s.strip.empty? ? APP_CONFIG[:default_release_notes] : options[:releasenotes]

UI.message("Using environment: #{environment}")
UI.message("Using app identifier: #{appidentifier}")
UI.message("Using provisioning profile: #{provisioningProfile}")
UI.message("Using version name: #{versionname}")
UI.message("Using release notes: #{releasenotes}")

if environment == "production"
increment_version_number(
Expand All @@ -158,6 +161,9 @@ platform :ios do
if environment == "production"
deliver(
app_identifier: appidentifier,
release_notes: ({
'default' => releasenotes
}),
submit_for_review: true,
force: true,
reject_if_possible: true,
Expand Down

0 comments on commit 1fe0835

Please sign in to comment.