Skip to content

Commit 9dd2236

Browse files
authored
Merge pull request #64 from TaleTime/feature/release-action
Added workflow for merging dev branch
2 parents 904ef75 + d4484a4 commit 9dd2236

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Merge dev branch for release
2+
3+
# Controls when the workflow will run
4+
on:
5+
# Allows you to run this workflow manually from the Actions tab
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release-project:
13+
# The type of runner that the job will run on
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
ref: "dev"
22+
- name: Prepare Git
23+
run: |
24+
git config --global user.name 'github-actions[bot]'
25+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
26+
27+
- name: "Get next version"
28+
uses: ietf-tools/semver-action@v1
29+
id: get_next_version
30+
with:
31+
token: ${{ github.token }}
32+
branch: dev
33+
- name: Show the next version
34+
run: |
35+
echo ${{ steps.get_next_version.outputs.next }}
36+
37+
- name: Bump version
38+
run: |
39+
sed -i "s/^version:.*$/version: ${{ steps.get_next_version.outputs.nextStrict }}/g" taletime/pubspec.yaml
40+
git commit -am "fix: Bumped version to ${{ steps.get_next_version.outputs.nextStrict }}"
41+
42+
- name: Merge into main
43+
run: |
44+
git checkout main
45+
git merge dev --no-ff
46+
- name: Create tag
47+
run: git tag ${{ steps.get_next_version.outputs.nextStrict }}
48+
- name: Merge back into dev
49+
run: |
50+
git checkout dev
51+
git merge main --no-ff
52+
53+
- name: Prepare next dev version
54+
run: |
55+
NEXT_VERSION=${{ steps.get_next_version.outputs.nextStrict }}
56+
IFS=. read -r v1 v2 v3 <<< "${NEXT_VERSION}"
57+
DEV_VERSION="${v1}.${v2}.$((v3 + 1))"
58+
sed -i "s/^version:.*$/version: ${DEV_VERSION}-SNAPSHOT/g" taletime/pubspec.yaml
59+
git commit -am "fix: Prepared next dev version: ${DEV_VERSION}-SNAPSHOT"
60+
61+
- name: Push everything
62+
run: git push origin main dev --tags
63+

0 commit comments

Comments
 (0)