generated from bitwarden/template
-
Notifications
You must be signed in to change notification settings - Fork 46
[BRE-769] Use Fastlane to keep github releases in sync with mobile deploy versions #1593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
michalchecinski
wants to merge
9
commits into
main
Choose a base branch
from
BRE-769-Use-Fastlane-to-keep-github-releases-in-sync-with-mobile-deploy-versions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
155e3bf
Add lane to get latest published version from App Store
michalchecinski c548523
Add GitHub Actions workflow for publishing releases
michalchecinski 53b3440
Update status of latest prerelease
michalchecinski 054209e
Enable scheduled GitHub release workflow for weekdays
michalchecinski 9825ed2
Rename job from 'create-release' to 'publish-release' in GitHub Actioโฆ
michalchecinski 43ab803
Refactor GitHub Actions workflow to use `gh` CLI for fetching latest โฆ
michalchecinski 60deb4f
Rename steps in GitHub Actions workflow to reflect draft release handโฆ
michalchecinski 89af3f9
Update GitHub release step to mark release as non-draft
michalchecinski 40ae989
Refactor version check logic to use environment variables for clarity
michalchecinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Publish GitHub Release as newest | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 3 * * 1-5' | ||
|
||
jobs: | ||
publish-release: | ||
name: Publish GitHub Release | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
contents: write | ||
actions: read | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get latest pre-release name | ||
id: get_latest_prerelease | ||
run: | | ||
latest_release=$(jq -r 'first' <<< $(curl --silent https://api.github.com/repos/bitwarden/ios/releases)) | ||
is_latest_prerelease=$(jq -r '.prerelease' <<< $latest_release) | ||
echo "is_latest_prerelease=$is_latest_prerelease" >> $GITHUB_OUTPUT | ||
|
||
if [ "$is_latest_prerelease" != "true" ]; then | ||
echo "No pre-release found" | ||
exit 0 | ||
fi | ||
|
||
latest_prerelease_version=$(jq -r '.tag_name' <<< $latest_release) | ||
echo "latest_prerelease_version=$latest_prerelease_version" >> $GITHUB_OUTPUT | ||
|
||
latest_prerelease_id=$(jq -r '.id' <<< $latest_release) | ||
echo "latest_prerelease_id=$latest_prerelease_id" >> $GITHUB_OUTPUT | ||
|
||
- name: Log in to Azure | ||
if: steps.get_latest_prerelease.outputs.is_latest_prerelease == 'true' | ||
uses: Azure/login@cb79c773a3cfa27f31f25eb3f677781210c9ce3d # v1.6.1 | ||
with: | ||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | ||
|
||
- name: Download Fastlane credentials | ||
if: steps.get_latest_prerelease.outputs.is_latest_prerelease == 'true' | ||
env: | ||
ACCOUNT_NAME: bitwardenci | ||
CONTAINER_NAME: mobile | ||
FILE: appstoreconnect-fastlane.json | ||
run: | | ||
mkdir -p $HOME/secrets | ||
az storage blob download --account-name $ACCOUNT_NAME --container-name $CONTAINER_NAME --name $FILE \ | ||
--file $HOME/secrets/$FILE --output none | ||
|
||
- name: Check released version | ||
if: steps.get_latest_prerelease.outputs.is_latest_prerelease == 'true' | ||
id: appstore_version | ||
run: | | ||
appstore_version=$(fastlane get_latest_version \ | ||
api_key_path:"$HOME/secrets/appstoreconnect-fastlane.json") | ||
|
||
echo "Latest version on App Store: $appstore_version" | ||
echo "appstore_version=$appstore_version" >> $GITHUB_OUTPUT | ||
|
||
- name: Check if version is already released | ||
if: steps.get_latest_prerelease.outputs.is_latest_prerelease == 'true' | ||
id: check_version | ||
run: | | ||
latest_prerelease_version=${{ steps.get_latest_prerelease.outputs.latest_prerelease_version }} | ||
appstore_version=${{ steps.appstore_version.outputs.appstore_version }} | ||
|
||
if [ "$latest_prerelease_version" == "$appstore_version" ]; then | ||
echo "Version $latest_prerelease_version is already released on App Store" | ||
echo "version_released=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "Version $latest_prerelease_version is not released on App Store" | ||
echo "version_released=false" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
- name: Make GitHub release latest and non-pre-release | ||
if: steps.check_version.outputs.version_released == 'true' | ||
id: make_release | ||
run: | | ||
latest_prerelease_version=${{ steps.get_latest_prerelease.outputs.latest_prerelease_version }} | ||
echo "Making release $latest_prerelease_version latest and non-pre-release" | ||
curl -X PATCH \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/bitwarden/ios/releases/$latest_prerelease_id \ | ||
-d '{"prerelease": false, "draft": false, "make_latest": true}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We create the releases as Drafts, not pre-releases; will those be picked up by that logic?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@differsthecat It won't. I changed it to pick up the draft releases. Is it the same for android?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that wil be the same for Android!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll change the worflows accordingly