Repository navigation
149 lines (126 loc) · 4.21 KB
/
Copy pathrelease.yml
File metadata and controls
149 lines (126 loc) · 4.21 KB
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
name: "Release actions"
on:
release:
types:
- published
env:
NODE_VERSION: 18
PYTHON_VERSION: "3.x"
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
translations:
runs-on: ubuntu-latest
steps:
- name: Set up the Lokalise CLI
uses: frenck/action-setup-lokalise@3b7316ecd78de134098918affa9cb7e7664888a5 # v1.0.1
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/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: translations
path: ./translations
if-no-files-found: error
retention-days: 1
build:
runs-on: ubuntu-latest
needs: translations
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
cache: yarn
node-version: ${{ env.NODE_VERSION }}
- name: Clear target directory
run: |
rm -R ./src/localize/languages/
mkdir -p ./src/localize/languages/
- name: Download translations
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
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/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
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:
attestations: write
contents: write
id-token: write
steps:
- name: Download dists
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0
with:
name: "dist"
path: "dist/"
- name: Publish dists to PyPI
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
- name: Attest
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 #v4.1.0
with:
subject-path: dist/*
- name: Upload release assets
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
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 }}