From 0eabd9d2e955ff0c39d310bedcc819a01c2a3bc8 Mon Sep 17 00:00:00 2001 From: Andrei Volkov Date: Fri, 20 Oct 2023 21:52:05 -0600 Subject: [PATCH] feat: added a workflow for build and release --- .github/workflows/build-and-release.yml | 35 ++++++++++++++++++++ .github/workflows/clear-cache.yml | 44 +++++++++++++++++++++++++ .github/workflows/test.yml | 6 +++- package-lock.json | 11 +++++-- package.json | 12 +++---- 5 files changed, 99 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/build-and-release.yml create mode 100644 .github/workflows/clear-cache.yml diff --git a/.github/workflows/build-and-release.yml b/.github/workflows/build-and-release.yml new file mode 100644 index 0000000..e87dad5 --- /dev/null +++ b/.github/workflows/build-and-release.yml @@ -0,0 +1,35 @@ +name: Build and release + +on: push + +concurrency: + group: build-and-release + cancel-in-progress: true + +jobs: + release: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [windows-latest] + + steps: + - name: Check out the repo + uses: actions/checkout@v1 + + - name: Install Node.js, npm, and Yarn + uses: actions/setup-node@v1 + with: + node-version: 10 + + - name: Build/release Electron app + uses: samuelmeuli/action-electron-builder@v1 + with: + # GitHub token, automatically provided to the action + # (No need to define this secret in the repo settings) + github_token: ${{ secrets.github_token }} + + # If the commit is tagged with a version (e.g. "v1.0.0"), + # release the app after building + release: ${{ startsWith(github.ref, 'refs/tags/v') }} diff --git a/.github/workflows/clear-cache.yml b/.github/workflows/clear-cache.yml new file mode 100644 index 0000000..82b71e0 --- /dev/null +++ b/.github/workflows/clear-cache.yml @@ -0,0 +1,44 @@ +name: Clear cache + +on: + workflow_dispatch: + +permissions: + actions: write + +jobs: + clear-cache: + runs-on: ubuntu-latest + steps: + - name: Clear cache + uses: actions/github-script@v6 + with: + script: | + try{ + const congif = { + owner: context.repo.owner, + repo: context.repo.repo, + per_page: 100, + }; + + console.log("Getting first 100 caches from github...") + let caches = await github.rest.actions.getActionsCacheList(congif); + while(caches.data.actions_caches.length){ + for (const cache of caches.data.actions_caches) { + console.log("Deleting cache..."); + const res = await github.rest.actions.deleteActionsCacheById({ + owner: context.repo.owner, + repo: context.repo.repo, + cache_id: cache.id, + }); + } + + caches = await github.rest.actions.getActionsCacheList(congif); + console.log(`Getting another ${caches.data.actions_caches.length} caches from github...`); + } + + console.log("Clear completed"); + } catch(e) { + console.log("The workflow had terminated with an error:", e) + return; + } diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9fed8fd..ed8639b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,13 +2,17 @@ name: Test on: [push, pull_request] +concurrency: + group: test + cancel-in-progress: true + jobs: release: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest, ubuntu-latest] + os: [windows-latest] steps: - name: Check out Git repository diff --git a/package-lock.json b/package-lock.json index 1a8e134..a55b0f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "marketeye-desktop-app", - "version": "1.1.1", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "marketeye-desktop-app", - "version": "1.1.1", + "version": "1.4.0", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -12821,6 +12821,13 @@ "node": ">=10" } }, + "node_modules/node-addon-api": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", + "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", + "dev": true, + "optional": true + }, "node_modules/node-api-version": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.1.4.tgz", diff --git a/package.json b/package.json index a4872f1..4c69b7b 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "marketeye-desktop-app", "description": "A private desktop app to analyze the stock market based on MarketEye API and electron-react-boilerplate", - "version": "1.4.0", + "version": "1.4.1", "scripts": { "build": "npm run build:main && npm run build:renderer", "build:main": "cross-env NODE_ENV=production TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.main.prod.ts", @@ -90,17 +90,17 @@ "publish": { "provider": "github", "owner": "andreyxdd", - "repo": "marketeye-desktop-app" + "repo": "marketeye-client" } }, "repository": { "type": "git", - "url": "git+https://github.com/andreyxdd/marketeye-desktop-app.git.git" + "url": "git+https://github.com/andreyxdd/marketeye-client.git.git" }, "author": { - "name": "Andrey Volkov", + "name": "Andrei Volkov", "email": "volkov@ualberta.ca", - "url": "https://linktr.ee/andreyxdd" + "url": "https://github.com/andreyxdd" }, "license": "MIT", "keywords": [ @@ -114,7 +114,7 @@ "market", "marketeye" ], - "homepage": "https://github.com/andreyxdd/marketeye-desktop-app#readme", + "homepage": "https://github.com/andreyxdd/marketeye-client#readme", "jest": { "testURL": "http://localhost/", "testEnvironment": "jsdom",