From f3c7583bf7ec4b54cb55ec294d42294ea5041343 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Fri, 1 Jul 2022 23:30:40 +0200 Subject: [PATCH] Add nightly frontend builds (#13061) --- .github/workflows/nightly.yaml | 63 ++++++++++++++++++++++++++++++++++ script/version_bump.js | 11 +++++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nightly.yaml diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml new file mode 100644 index 0000000000..b9cace1ad1 --- /dev/null +++ b/.github/workflows/nightly.yaml @@ -0,0 +1,63 @@ +name: Nightly + +on: + workflow_dispatch: + schedule: + - cron: "0 1 * * *" + +env: + PYTHON_VERSION: 3.8 + NODE_VERSION: 14 + NODE_OPTIONS: --max_old_space_size=6144 + +permissions: + actions: none + +jobs: + nightly: + name: Nightly + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout the repository + uses: actions/checkout@v2 + + - 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: Bump version + run: script/version_bump.js nightly + + - name: Build nightly Python wheels + run: | + pip install build + yarn install + + script/build_frontend + + rm -rf dist home_assistant_frontend.egg-info + python3 -m build + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: wheels + path: dist/ + if-no-files-found: error diff --git a/script/version_bump.js b/script/version_bump.js index 7796f1451a..a1c8f9c9be 100755 --- a/script/version_bump.js +++ b/script/version_bump.js @@ -24,10 +24,15 @@ function auto(version) { return patch(version); } +function nightly() { + return `${today()}.dev`; +} + const methods = { patch, today, auto, + nightly, }; async function main(args) { @@ -57,7 +62,11 @@ async function main(args) { console.log("Current version:", version); console.log("New version:", newVersion); - fs.writeFileSync("pyproject.toml", setup.replace(version, newVersion), "utf-8"); + fs.writeFileSync( + "pyproject.toml", + setup.replace(version, newVersion), + "utf-8" + ); if (!commit) { return;