Skip to content

Commit 4799a1e

Browse files
authored
chore: configure release pipeline (#2507)
1 parent d1336e6 commit 4799a1e

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/release.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
env:
8+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9+
10+
jobs:
11+
release:
12+
if: ${{ github.repository == 'fossasia/pslab-android' }}
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Download repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Ruby
20+
uses: ruby/setup-ruby@v1
21+
with:
22+
ruby-version: '3.3'
23+
bundler-cache: true
24+
25+
- name: Prepare Bundler
26+
run: |
27+
bundle config path vendor/bundle
28+
bundle install --jobs 4 --retry 3
29+
30+
- name: Download Assets
31+
id: download-assets
32+
run: |
33+
gh release download ${{ github.event.release.tag_name }} --pattern '*.txt'
34+
read -r version_code < versionCode.txt
35+
echo "VERSION_CODE=$version_code" >> $GITHUB_OUTPUT
36+
37+
- name: Add Changelogs to fastlane branch
38+
run: |
39+
git config --global user.name "github-actions[bot]"
40+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
41+
42+
git clone --branch=fastlane https://${{ github.repository_owner }}:${{ github.token }}@github.com/${{ github.repository }} fastlane
43+
cd fastlane
44+
45+
echo "${{ github.event.release.body }}" > metadata/android/en-US/changelogs/${{ steps.download-assets.outputs.VERSION_CODE }}.txt
46+
47+
# Force push to fastlane branch
48+
git checkout --orphan temporary
49+
git add --all .
50+
git commit -am "[Auto] Add changelogs for versionCode: ${{ steps.download-assets.outputs.VERSION_CODE }} ($(date +%Y-%m-%d.%H:%M:%S))"
51+
git branch -D fastlane
52+
git branch -m fastlane
53+
git push --force origin fastlane
54+
55+
- name: Push version to production
56+
run: |
57+
bundle exec fastlane promoteToProduction version_code:${{ steps.download-assets.outputs.VERSION_CODE }}
58+
if [[ $? -ne 0 ]]; then
59+
exit 1
60+
fi

0 commit comments

Comments
 (0)