20240114080055 #229
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Release actions" | |
on: | |
release: | |
types: ["published"] | |
env: | |
NODE_VERSION: 18 | |
PYTHON_VERSION: "3.x" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
name: Deploy to PyPi | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: recursive | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
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 | |
# Get updated translations | |
- name: Download Lokalise CLI | |
run: | | |
curl -sfL https://raw.githubusercontent.com/lokalise/lokalise-cli-2-go/master/install.sh | sh | |
- name: Downloading translations | |
run: | | |
./bin/lokalise2 \ | |
--token "${{ secrets.lokalise_token }}"\ | |
--project-id "854515055f679055040b37.42677693" \ | |
file download \ | |
--format json \ | |
--unzip-to /tmp/lokalise \ | |
--export-empty-as skip \ | |
--export-sort a_z \ | |
--original-filenames=false \ | |
--bundle-structure %LANG_ISO%.%FORMAT% | |
- name: Move new translations | |
run: | | |
rm -R /home/runner/work/frontend/frontend/src/localize/languages/ | |
mkdir -p /home/runner/work/frontend/frontend/src/localize/languages/ | |
cp /tmp/lokalise/* /home/runner/work/frontend/frontend/src/localize/languages/ | |
- name: "Set version number" | |
run: | | |
export version=${{ github.ref }} | |
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: Publish to PyPi | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* | |
- name: Discord notification | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/[email protected] | |
with: | |
args: "New version of HACS frontend are now pushed to [PyPi](https://pypi.org/project/hacs-frontend)." |