-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (76 loc) · 3.04 KB
/
release.yml
File metadata and controls
87 lines (76 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Releases
on:
push:
branches:
- 'main'
permissions:
contents: read
jobs:
versions:
name: Update Releases
runs-on: ubuntu-latest
permissions:
contents: write # for release-drafter/release-drafter to create a github release
pull-requests: write # for release-drafter/release-drafter to add label to PR
env:
VERSION_CHANGED: false
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
- name: Setup Git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- uses: actions/setup-node@v6
with:
cache: "npm"
node-version-file: ".node_version"
- name: Draft Release
id: release
# Drafts your next Release notes as Pull Requests are merged into "main"
uses: release-drafter/release-drafter@v7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Check for version change
run: |
CURRENT_VERSION=$(npm pkg get version)
CURRENT_VERSION="${CURRENT_VERSION%\"}"
CURRENT_VERSION="${CURRENT_VERSION#\"}"
NEW_VERSION="${{ steps.release.outputs.resolved_version }}"
echo "Current Version: $CURRENT_VERSION"
echo "New Version: $NEW_VERSION"
V_CHANGED=false [ "$CURRENT_VERSION" != "$NEW_VERSION" ] && V_CHANGED=true
echo "VERSION_CHANGED=$V_CHANGED" >> $GITHUB_ENV
echo "Version Changed: $V_CHANGED"
- name: Update package.json version
if: env.VERSION_CHANGED == 'true'
id: package-version
run: |
echo "Next Version: ${{ steps.release.outputs.resolved_version }}"
npm version --git-tag-version=false --allow-same-version=true ${{ steps.release.outputs.resolved_version }}
- name: Update Android Version
if: env.VERSION_CHANGED == 'true'
uses: chkfung/android-version-actions@v1.2.3
with:
gradlePath: ./android/app/build.gradle
versionCode: ${{github.run_number}}
versionName: ${{ steps.release.outputs.resolved_version }}
# - name: Update IOS Info.plist versions
# if: env.VERSION_CHANGED == 'true'
# id: ios-version
# uses: damienaicheh/update-ios-version-info-plist-action@v1.2.0
# with:
# info-plist-path: "./ios/App/App/Info.plist"
# bundle-short-version-string: "${{ steps.release.outputs.resolved_version }}"
# bundle-version: "${{ steps.release.outputs.resolved_version }}"
- name: Create Pull Request
if: env.VERSION_CHANGED == 'true'
uses: peter-evans/create-pull-request@v8
with:
title: "App Version ${{ steps.release.outputs.resolved_version }}"
body: "Update Version to ${{ steps.release.outputs.resolved_version }}"
commit-message: "version: ${{ steps.release.outputs.resolved_version }}"
branch: "version-bump/${{ steps.release.outputs.resolved_version }}"
labels: |-
version