-
Notifications
You must be signed in to change notification settings - Fork 7
151 lines (146 loc) · 5.57 KB
/
release.yaml
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: peaq charmev release
on:
# Enable manual run
workflow_dispatch:
# Refs/tags push events to matching v*, i.e. v1.0, v20.15.10
push:
branches:
- 'dev'
- 'main'
concurrency:
group: release
jobs:
generate-changelog:
name: Generate changelog
runs-on: ubuntu-latest
outputs:
next-version: ${{ steps.bump_version.outputs.next-version }}
prerelease: ${{ steps.set_outputs.outputs.prerelease }}
release-type: ${{ steps.set_outputs.outputs.release-type }}
steps:
- name: print env
run: env
- name: Checkout charmev code
uses: actions/checkout@v2
- name: Get commit message
id: set_outputs
run: |
comment=$(git log -1 --pretty=format:"%s" ${{ github.sha }})
# set comming change is feature or fix
if [[ "$comment" == */feature/* ]] || [[ "$comment" == */feat/* ]] || [[ "$comment" == */dev ]]; then
echo ::set-output name=version-fragment::feature
elif [[ "$comment" == */bug/* ]] || [[ "$comment" == */fix/* ]] || [[ "$comment" == */hotfix/* ]]; then
echo ::set-output name=version-fragment::bug
else
echo ::set-output name=version-fragment::alpha
fi
# set type of release, changes to dev will release as prerelease and to main as release
if [[ ${{ github.ref_name }} == 'dev' ]]; then
echo ::set-output name=prerelease::true
echo ::set-output name=release-type::prerelease
else
echo ::set-output name=prerelease::false
echo ::set-output name=release-type::stable
fi
- name: Get latest release
uses: rez0n/actions-github-release@main
id: get_latest_release
env:
token: ${{ secrets.TOKEN }}
repository: ${{ github.repository }}
type: "nodraft"
- name: Next release version
id: bump_version
uses: christian-draeger/increment-semantic-version@1.0.2
with:
current-version: ${{ steps.get_latest_release.outputs.release }}
version-fragment: ${{ steps.set_outputs.outputs.version-fragment }}
- name: Generate changelog since last published release
uses: charmixer/auto-changelog-action@5c6320ae4dedc8743e4439a3c56294c294553fb9
with:
token: ${{ secrets.TOKEN }}
future_release: ${{ steps.bump_version.outputs.next-version}}
since_tag: ${{ steps.get_latest_release.outputs.release }}
- name: Upload changelog
uses: actions/upload-artifact@v2
with:
name: changelog
path: CHANGELOG.md
release:
name: Release ${{ github.ref_name }}
needs: generate-changelog
runs-on: ubuntu-20.04
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Download changelog
uses: actions/download-artifact@v2
with:
name: changelog
- name: Pre release with changelog
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: ${{ needs.generate-changelog.outputs.next-version }}
release_name: peaq charmev ${{ needs.generate-changelog.outputs.next-version }}
body_path: CHANGELOG.md
draft: false
prerelease: ${{ needs.generate-changelog.outputs.prerelease }}
create-build:
name: Create ${{ matrix.target }} build
runs-on: ${{ matrix.os }}
strategy:
matrix:
target: [Android]
include:
- os: ubuntu-20.04
target: Android
build_target: apk
build_path: build/app/outputs/flutter-apk
asset_extension: .apk
asset_content_type: application/vnd.android.package-archive
# Disable fail-fast as we want results from all even if one fails.
fail-fast: false
needs: release
steps:
# Set up Flutter.
- name: Clone Flutter repository with flutter-version 3.0.5
uses: subosito/flutter-action@v2
with:
flutter-version: '3.0.5'
- name: Install Linux dependencies
if: matrix.target == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libx11-dev pkg-config cmake ninja-build libblkid-dev
- name: Install Android dependencies
if: matrix.target == 'Android'
uses: actions/setup-java@v1
with:
java-version: "1.8"
- run: flutter doctor -v
- name: Checkout charmev code
uses: actions/checkout@v2
- run: echo "workspcae=$GITHUB_WORKSPACE" >> $GITHUB_ENV
- run: flutter clean
- run: flutter pub get
# Build the application.
- run: flutter build -v ${{ matrix.build_target }} --release
# Package the build.
- name: Rename build for Android
if: matrix.target == 'Android'
run: mv app-release.apk $GITHUB_WORKSPACE/peaq_charmev_${{ matrix.target }}.apk
working-directory: ${{ matrix.build_path }}
# Upload the build.
- name: Add packaged build to release of ${{ github.ref_name }}
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_path: ${{ env.workspcae }}/peaq_charmev_${{ matrix.target }}${{ matrix.asset_extension }}
asset_name: peaq_charmev_${{ matrix.target }}${{ matrix.asset_extension }}
asset_content_type: ${{ matrix.asset_content_type }}