Skip to content

Merge pull request #2661 from alandtse/dev #373

Merge pull request #2661 from alandtse/dev

Merge pull request #2661 from alandtse/dev #373

name: semantic_release
on:
push:
branches:
- master
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
ref: master
token: ${{ secrets.GH_TOKEN }}
- name: Download lokalise translations
run: |
docker run -v /tmp/lokalise:/opt/dest lokalise/lokalise-cli-2 lokalise2 \
--token "${{ secrets.lokalise_token }}" \
--project-id 465185555eee18dd537ca6.39714580 file download \
--format json \
--unzip-to /opt/dest \
--original-filenames=false \
--export-sort a_z \
--placeholder-format icu \
--json-unescaped-slashes=true \
--indentation 2sp \
--export-empty-as base \
--add-newline-eof \
--replace-breaks=false
- name: Move new translations
run: |
cp /tmp/lokalise/locale/* /home/runner/work/alexa_media_player/alexa_media_player/custom_components/alexa_media/translations/
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
# #----------------------------------------------
# # ----- install & configure poetry -----
# #----------------------------------------------
# - name: Install Poetry
# uses: snok/install-poetry@v1
# with:
# virtualenvs-create: true
# virtualenvs-in-project: true
# installer-parallel: true
# #----------------------------------------------
# # load cached venv if cache exists
# #----------------------------------------------
# - name: Load cached venv
# id: cached-poetry-dependencies
# uses: actions/cache@v2
# with:
# path: .venv
# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
# #----------------------------------------------
# # install dependencies if cache does not exist
# #----------------------------------------------
# - name: Install dependencies
# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# run: poetry install --no-interaction --no-root
# #----------------------------------------------
# # install your root project, if required
# #----------------------------------------------
# - name: Install library
# run: poetry install --no-interaction
- name: Setup Git
run: |
git config --global user.name "semantic-release"
git config --global user.email "semantic-release@GitHub"
- name: Commit translation files
continue-on-error: true
run: |
git add custom_components/alexa_media/translations/*.json
git commit -m "docs: update localization" -a
- name: Python Semantic Release
uses: relekang/[email protected]
with:
github_token: ${{ secrets.GH_TOKEN }}
# Pack the alexa_media_player dir as a zip and upload to the release
- name: Zip alexa_media dir
run: |
cd /home/runner/work/alexa_media_player/alexa_media_player/custom_components/alexa_media
zip alexa_media.zip -r ./
- name: Set release variable
run: |
echo "release_version=`git describe --abbrev=0`" >> $GITHUB_ENV
- name: Sleep
# add delay so upload does not kill the release notes from semantic-release
run: |
sleep 5
- name: Upload zip to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GH_TOKEN }}
file: /home/runner/work/alexa_media_player/alexa_media_player/custom_components/alexa_media/alexa_media.zip
asset_name: alexa_media.zip
tag: ${{ env.release_version }}
overwrite: true
- name: Push changes to dev
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: dev