Skip to content

Commit 9769e75

Browse files
committed
CI split build & release
1 parent f8193ad commit 9769e75

File tree

2 files changed

+59
-35
lines changed

2 files changed

+59
-35
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ on:
55
paths-ignore:
66
- "README.md"
77
branches:
8-
- master
9-
tags:
10-
- "v*"
8+
- "*"
119
pull_request:
1210
branches:
13-
- master
11+
- "*"
1412
schedule:
1513
- cron: "0 8 1 * *"
1614

@@ -21,14 +19,6 @@ jobs:
2119
- name: Checkout
2220
uses: actions/checkout@v2
2321

24-
- name: Prepare
25-
id: prepare
26-
run: |
27-
git fetch --prune --unshallow --tags
28-
29-
CURRENT_TAG=$(git tag --points-at HEAD)
30-
echo ::set-output name=version::${CURRENT_TAG//v}
31-
3222
- name: Set up Python
3323
uses: actions/setup-python@v2
3424

@@ -41,26 +31,3 @@ jobs:
4131
if: success()
4232
run: |
4333
platformio run -e ethernet-relay-temp-v1 -e ethernet-relay-temp-v1-debug
44-
45-
- name: Create release
46-
if: ${{ success() && steps.prepare.outputs.version != null }}
47-
run: |
48-
set -x
49-
assets=()
50-
51-
for path in ./.pio/build/*/; do
52-
name="$(basename "${path}")"
53-
mv "./.pio/build/$name/firmware.bin" "$name.bin"
54-
assets+=("-a" "$name.bin")
55-
done
56-
57-
echo "FW ${{ steps.prepare.outputs.version }}" >"CHANGELOG.md"
58-
echo "" >>"CHANGELOG.md"
59-
echo "## :bookmark_tabs: Changes" >>"CHANGELOG.md"
60-
git log --pretty=format:"- %s %H%n" $(git describe --abbrev=0 --tags $(git describe --tags --abbrev=0)^)...$(git describe --tags --abbrev=0) >>"CHANGELOG.md"
61-
62-
cat "CHANGELOG.md"
63-
64-
hub release create "${assets[@]}" "--file" "CHANGELOG.md" "$(git tag --points-at HEAD)"
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Prepare
16+
id: prepare
17+
run: |
18+
git fetch --prune --unshallow --tags
19+
20+
CURRENT_TAG=$(git tag --points-at HEAD)
21+
echo ::set-output name=version::${CURRENT_TAG//v}
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install platformio
30+
31+
- name: Build
32+
if: success()
33+
run: |
34+
platformio run -e ethernet-relay-temp-v1 -e ethernet-relay-temp-v1-debug
35+
36+
- name: Create release
37+
if: ${{ success() && steps.prepare.outputs.version != null }}
38+
run: |
39+
set -x
40+
assets=()
41+
42+
for path in ./.pio/build/*/; do
43+
name="$(basename "${path}")"
44+
mv "./.pio/build/$name/firmware.bin" "$name.bin"
45+
assets+=("-a" "$name.bin")
46+
done
47+
48+
echo "FW ${{ steps.prepare.outputs.version }}" >"CHANGELOG.md"
49+
echo "" >>"CHANGELOG.md"
50+
echo "## :bookmark_tabs: Changes" >>"CHANGELOG.md"
51+
git log --pretty=format:"- %s %H%n" $(git describe --abbrev=0 --tags $(git describe --tags --abbrev=0)^)...$(git describe --tags --abbrev=0) >>"CHANGELOG.md"
52+
53+
cat "CHANGELOG.md"
54+
55+
hub release create "${assets[@]}" "--file" "CHANGELOG.md" "$(git tag --points-at HEAD)"
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)