-
-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (69 loc) · 2.52 KB
/
release.yml
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
---
name: "Release"
on:
push:
tags:
- "[v0-9]+.[0-9]+*"
jobs:
release:
name: "Publish new release"
runs-on: ubuntu-latest
steps:
- name: "Check out repository"
uses: actions/checkout@v3
- working-directory: ./custom_components
run: |
echo "package=$(ls -F | grep \/$ | sed -n "s/\///g;1p")" >> $GITHUB_ENV
echo "release_version=$(git describe --tags | sed s/v//)" >> $GITHUB_ENV
- working-directory: ./custom_components
run: |
echo "basedir=$(pwd)/${{ env.package }}" >> $GITHUB_ENV
- name: "Setup Git"
if: env.release_version != '' && success()
run: |
git config --global user.name "release"
git config --global user.email "release@GitHub"
- name: "Zip component dir"
if: env.release_version != '' && success()
working-directory: ./custom_components/${{ env.package }}
run: |
zip ${{ env.package }}.zip -r ./
- name: "Release"
if: env.release_version != '' && success()
uses: softprops/action-gh-release@v1
with:
files: ${{ env.basedir }}/${{ env.package }}.zip
release-notes:
name: "Compose release notes"
needs: release
runs-on: ubuntu-latest
steps:
- name: "Check out repository"
uses: actions/checkout@v3
- working-directory: ./custom_components
run: |
echo "release_version=$(git describe --tags | sed s/v//)" >> $GITHUB_ENV
- name: "Set up Python"
if: env.release_version != '' && success()
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: "Cache pip"
if: env.release_version != '' && success()
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements*.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: "Install requirements"
if: env.release_version != '' && success()
run: |
python3 -m pip install setuptools wheel
python3 -m pip install -r ./requirements-dev.txt
- name: "Update release notes"
if: env.release_version != '' && success()
run: python3 ./bin/gen_releasenotes --token ${{ secrets.GITHUB_TOKEN }} --repo ${{ github.repository }} --release ${{ env.release_version }}