-
-
Notifications
You must be signed in to change notification settings - Fork 88
144 lines (122 loc) · 3.72 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
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
name: "Release actions"
on:
release:
types:
- published
env:
NODE_VERSION: 18
PYTHON_VERSION: "3.x"
permissions: {}
jobs:
translations:
runs-on: ubuntu-latest
steps:
- name: Set up the Lokalise CLI
uses: frenck/[email protected]
with:
version: v2.6.10
- name: Download translations
run: |
lokalise2 \
--token "${{ secrets.lokalise_token }}" \
--project-id "854515055f679055040b37.42677693" \
file download \
--format json \
--unzip-to ./translations \
--export-empty-as skip \
--export-sort a_z \
--original-filenames=false \
--bundle-structure %LANG_ISO%.%FORMAT%
- name: Upload dists
uses: actions/[email protected]
with:
name: translations
path: ./translations
if-no-files-found: error
retention-days: 1
build:
runs-on: ubuntu-latest
needs: translations
steps:
- uses: actions/[email protected]
with:
submodules: recursive
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Node ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
cache: yarn
- name: Clear target directory
run: |
rm -R ./src/localize/languages/
mkdir -p ./src/localize/languages/
- name: Download translations
uses: actions/[email protected]
with:
name: translations
path: "./src/localize/languages/"
- name: "Set version number"
run: |
export version=${{ github.event.release.tag_name }}
sed -i "s|main|${version##*/}|" ./setup.py
sed -i "s|main|${version##*/}|" ./public/version.py
sed -i "s|main|${version##*/}|" ./src/version.ts
cat ./setup.py
cat ./public/version.py
cat ./src/version.ts
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
script/bootstrap
- name: Build
run: script/build
- name: Package
run: python setup.py sdist bdist_wheel
- name: Upload dists
uses: actions/[email protected]
with:
name: "dist"
path: "dist/"
if-no-files-found: error
retention-days: 5
publish:
runs-on: ubuntu-latest
needs: build
environment:
name: release
url: https://pypi.org/p/hacs-frontend
permissions:
id-token: write
contents: write
steps:
- name: Download dists
uses: actions/[email protected]
with:
name: "dist"
path: "dist/"
- name: Publish dists to PyPI
uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
- name: Attest
uses: actions/attest-build-provenance@173725a1209d09b31f9d30a3890cf2757ebbff0d #v1.1.2
with:
subject-path: dist/*
- name: Upload release assets
uses: softprops/[email protected]
with:
files: dist/*
notify:
runs-on: ubuntu-latest
name: Trigger Discord notification
needs: publish
steps:
- name: Discord notification
run: |
curl \
-H "Content-Type: application/json" \
-d '{"username": "GitHub Action", "content": "New version of HACS frontend are now pushed to [PyPi](<https://pypi.org/project/hacs-frontend>)"}' \
${{ secrets.DISCORD_WEBHOOK }}