From 276252f328fb50c753aa39dee52c8535c6438d45 Mon Sep 17 00:00:00 2001 From: Anton Fischl Date: Sun, 13 Mar 2022 10:01:56 +0100 Subject: [PATCH 1/2] added workflow to build HA Frontend SDIST Signed-off-by: Anton Fischl --- .../workflows/check-ha-frontend-release.yml | 44 +++++++++++ .github/workflows/make-ha-frontend-sdist.yml | 79 +++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 .github/workflows/check-ha-frontend-release.yml create mode 100644 .github/workflows/make-ha-frontend-sdist.yml diff --git a/.github/workflows/check-ha-frontend-release.yml b/.github/workflows/check-ha-frontend-release.yml new file mode 100644 index 000000000..9a84b9cd6 --- /dev/null +++ b/.github/workflows/check-ha-frontend-release.yml @@ -0,0 +1,44 @@ +name: 'HA Frontend - check new relase' + +on: + workflow_dispatch: + schedule: + - cron: '17 * * * *' # @Hourly + +jobs: + check-new-release: + runs-on: ubuntu-latest + outputs: + skip: ${{ steps.check-version.outputs.cache-hit }} + steps: + - name: Get latest version + id: latest-version + run: | + git ls-remote --tags --sort="version:refname" https://github.com/home-assistant/frontend.git|grep -E "refs/tags/20[2-9][0-9]{5}\.[0-9]$"|tail -1|awk -F / '{print $3}' > latest-release + cat latest-release + echo "::set-output name=latest-version::$(cat latest-release)" + + - name: Check if we allready did this version + id: check-version + uses: actions/cache@v2 + with: + key: ${{ steps.latest-version.outputs.latest-version }} + path: latest-release + + make-ha-frontend-sdist: + needs: check-new-release + if: ${{ !needs.check-new-release.outputs.skip }} + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + github-token: ${{ secrets.PAT_TOKEN }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'onkelbeh', + repo: 'HomeAssistantRepository', + workflow_id: 'make-ha-frontend-sdist.yml', + ref: 'main' + }) + + diff --git a/.github/workflows/make-ha-frontend-sdist.yml b/.github/workflows/make-ha-frontend-sdist.yml new file mode 100644 index 000000000..e19e64af7 --- /dev/null +++ b/.github/workflows/make-ha-frontend-sdist.yml @@ -0,0 +1,79 @@ +name: 'HA Frontend - make SDIST' + +on: + workflow_dispatch: + +env: + PYTHON_VERSION: 3.8 + NODE_VERSION: 14 + NODE_OPTIONS: --max_old_space_size=6144 + +jobs: + make-sdist: + runs-on: ubuntu-latest + + steps: + - name: get-version + id: get-version + run: | + git ls-remote --tags --sort='version:refname' https://github.com/home-assistant/frontend.git|grep -E 'refs/tags/20[2-9][0-9]{5}\.[0-9]$'|tail -1|awk -F / '{print $3}' + echo "::set-output name=version::$(git ls-remote --tags --sort='version:refname' https://github.com/home-assistant/frontend.git|grep -E 'refs/tags/20[2-9][0-9]{5}\.[0-9]$'|tail -1|awk -F / '{print $3}')" + + - name: Checkout frontend repository + uses: actions/checkout@v3 + with: + repository: home-assistant/frontend + ref: ${{ steps.get-version.outputs.version }} + + - name: Set up Python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@v2 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Set up Node ${{ env.NODE_VERSION }} + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION }} + cache: yarn + + - name: Install dependencies + run: yarn install + + - name: Download Translations + run: ./script/translations_download + env: + LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }} + + - name: Build and release package + run: | + python3 -m pip install build + #export TWINE_USERNAME="__token__" + #export TWINE_PASSWORD="${{ secrets.TWINE_TOKEN }}" + #script/release + script/build_frontend + rm -rf dist home_assistant_frontend.egg-info + python3 -m build + + - name: Upload build artifacts + uses: actions/upload-artifact@v2 + with: + name: ha-frontend-${{ steps.get-version.outputs.version }} + path: ./dist/*.tar.gz + + - name: Upload SDIST to nextcloud + run: | + sudo add-apt-repository ppa:nextcloud-devs/client + sudo apt update + sudo apt install nextcloud-client + rm dist/*.whl + sudo nextcloudcmd -s -u ${{ secrets.NEXTCLOUD_USER }} -p ${{ secrets.NEXTCLOUD_PASSWORD }} --non-interactive dist/ ${{ secrets.NEXTCLOUD_URL }} + + - name: Create Issue + uses: actions-ecosystem/action-create-issue@v1 + with: + github_token: ${{ secrets.PAT_TOKEN }} + title: new HA Frontend ${{ steps.get-version.outputs.version }} + body: | + SDIST uploaded to nextcloud + + From 106f0b18c94ac19dd5db614dbf96aafefab88998 Mon Sep 17 00:00:00 2001 From: Andreas Billmeier Date: Sun, 13 Mar 2022 10:49:09 +0100 Subject: [PATCH 2/2] fix typo --- .github/workflows/check-ha-frontend-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-ha-frontend-release.yml b/.github/workflows/check-ha-frontend-release.yml index 9a84b9cd6..c6ba85839 100644 --- a/.github/workflows/check-ha-frontend-release.yml +++ b/.github/workflows/check-ha-frontend-release.yml @@ -1,4 +1,4 @@ -name: 'HA Frontend - check new relase' +name: 'HA Frontend - check new release' on: workflow_dispatch: