Skip to content

Commit

Permalink
Updated workflow to also include release notes (#29)
Browse files Browse the repository at this point in the history
Updated workflow to also include release notes (#29)
  • Loading branch information
Burzo authored Apr 1, 2024
1 parent 3cfc8cf commit 774146d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 47 deletions.
46 changes: 25 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,43 @@ name: Build and Deploy to App Distribution and Testflight
on:
workflow_dispatch:
push:
branches:
- "main"
tags:
- "*"

jobs:
extract-version:
name: Extract Version
extract-metadata:
name: Extract app metadata
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.version }}
release_notes: ${{ steps.extract-version.outputs.release_notes }}
version: ${{ steps.extract-metadata.outputs.version }}
release_notes: ${{ steps.extract-metadata.outputs.release_notes }}
steps:
- name: Extract version
id: extract-version
- name: Extract version and release notes
id: extract-metadata
run: |
VERSION="${{ github.ref_name }}"
echo "Original version: $VERSION"
VERSION="${VERSION#"v"}"
echo "Processed version: $VERSION"
echo "::set-output name=version::$VERSION"
RELEASE_NOTES=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/tags/v0.0.15" | jq -r '.body')
RELEASE_NOTES=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}" | jq -r '.body')
echo "Release notes: $RELEASE_NOTES"
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}"
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}"
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}"
echo "::set-output name=release_notes::$RELEASE_NOTES"
ios-build:
needs: extract-version
needs: extract-metadata
environment: development
name: iOS development build
runs-on: macos-latest
steps:
- name: Add release notes
run: |
echo -n "${{ needs.extract-version.outputs.release_notes }}" > ./release_notes.txt
- name: Cancel previous runs
uses: styfle/[email protected]
- name: Checkout repo from dev branch
- name: Checkout repo from branch
uses: actions/checkout@v3
- name: create-json
id: add-firebase-credentials
Expand All @@ -46,6 +48,9 @@ jobs:
name: "wildlife-watcher-service-account.json"
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
dir: "./fastlane"
- name: Add release notes
run: |
echo -n "${{ needs.extract-metadata.outputs.release_notes }}" > ./release_notes.txt
- name: Copy App Store Provisioning certificate
run: echo -n "${{ secrets.IOS_CERT_PROVISION }}" | base64 --decode > ./fastlane/profile.mobileprovision
- name: Copy Testers Provisioning certificate
Expand All @@ -67,23 +72,20 @@ jobs:
env:
IOS_CERT_PASSWORD: ${{ secrets.IOS_CERT_PASSWORD }}
IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
APP_VERSION: ${{ needs.extract-version.outputs.version }}
APP_VERSION: ${{ needs.extract-metadata.outputs.version }}
APP_ID: ${{ vars.APP_ID_IOS }}
TESTERS: ${{ vars.TESTERS }}
android-build:
needs: extract-version
needs: extract-metadata
environment: development
name: Android development build
runs-on: ubuntu-latest
container:
image: reactnativecommunity/react-native-android
steps:
- name: Add release notes
run: |
echo -n "${{ needs.extract-version.outputs.release_notes }}" > ./release_notes.txt
- name: Cancel previous runs
uses: styfle/[email protected]
- name: Checkout repo from dev branch
- name: Checkout repo from branch
uses: actions/checkout@v3
- name: create-json
id: add-firebase-credentials
Expand All @@ -92,6 +94,8 @@ jobs:
name: "wildlife-watcher-service-account.json"
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
dir: "./fastlane"
- name: Add release notes
run: echo -n "${{ needs.extract-metadata.outputs.release_notes }}" > ./release_notes.txt
- name: create-json
id: add-android-credentials
uses: jsdaniell/[email protected]
Expand All @@ -115,7 +119,7 @@ jobs:
run: |
bundle exec fastlane android build_release
env:
APP_VERSION: ${{ needs.extract-version.outputs.version }}
APP_VERSION: ${{ needs.extract-metadata.outputs.version }}
APP_CODE_VERSION: ${{ github.run_number }}
APP_ID: ${{ vars.APP_ID_ANDROID }}
TESTERS: ${{ vars.TESTERS }}
37 changes: 11 additions & 26 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,6 @@ platform :ios do
desc "Build a release version of the app"

lane :build_release do

# Check if the release_notes.txt file exists
if File.exist?("./release_notes.txt")
# Read the contents of the file
release_notes_content = File.read("./release_notes.txt")

# Print the contents of the file
puts "Release Notes:"
puts release_notes_content
else
puts "Release notes file not found"
puts "Current directory: #{Dir.pwd}"
puts "Files in current directory: #{Dir.entries(".")}"
end

create_keychain(
name: "com.wildlife.wildlifewatcher",
password: ENV["IOS_KEYCHAIN_PASSWORD"],
Expand Down Expand Up @@ -81,17 +66,17 @@ platform :ios do
release_notes_file: './release_notes.txt'
)

build_ios_app(
silent: true,
scheme: 'WildlifeWatcher',
configuration: "Release",
workspace: './ios/WildlifeWatcher.xcworkspace',
output_directory: './ios/ipa',
output_name: 'WildlifeWatcher.ipa',
buildlog_path: './ios/logs',
suppress_xcode_output: true,
export_options: "./ios/WildlifeWatcher/exportOptions.plist"
)
# build_ios_app(
# silent: true,
# scheme: 'WildlifeWatcher',
# configuration: "Release",
# workspace: './ios/WildlifeWatcher.xcworkspace',
# output_directory: './ios/ipa',
# output_name: 'WildlifeWatcher.ipa',
# buildlog_path: './ios/logs',
# suppress_xcode_output: true,
# export_options: "./ios/WildlifeWatcher/exportOptions.plist"
# )

# Should upload to testflight at this point
end
Expand Down

0 comments on commit 774146d

Please sign in to comment.