Skip to content

Commit

Permalink
chore: configure release pipeline (#2507)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsCress authored Jun 30, 2024
1 parent d1336e6 commit 4799a1e
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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

0 comments on commit 4799a1e

Please sign in to comment.