Release #1
Workflow file for this run
This file contains 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
name: Release | |
on: | |
release: | |
types: [published] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
release: | |
if: ${{ github.repository == 'fossasia/pslab-android' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download repository | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.3' | |
bundler-cache: true | |
- name: Prepare Bundler | |
run: | | |
bundle config path vendor/bundle | |
bundle install --jobs 4 --retry 3 | |
- name: Download Assets | |
id: download-assets | |
run: | | |
gh release download ${{ github.event.release.tag_name }} --pattern '*.txt' | |
read -r version_code < versionCode.txt | |
echo "VERSION_CODE=$version_code" >> $GITHUB_OUTPUT | |
- name: Add Changelogs to fastlane branch | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git clone --branch=fastlane https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane | |
cd fastlane | |
echo "${{ github.event.release.body }}" > metadata/android/en-US/changelogs/${{ steps.download-assets.outputs.VERSION_CODE }}.txt | |
# Force push to fastlane branch | |
git checkout --orphan temporary | |
git add --all . | |
git commit -am "[Auto] Add changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))" | |
git branch -D fastlane | |
git branch -m fastlane | |
git push --force origin fastlane | |
- name: Push version to production | |
run: | | |
bundle exec fastlane promoteToProduction version_code:${{ steps.download-assets.outputs.VERSION_CODE }} | |
if [[ $? -ne 0 ]]; then | |
exit 1 | |
fi |