From 6bbad55bc817ae0b858db89e0fd65f48c9e0127f Mon Sep 17 00:00:00 2001 From: Solareon <769465+solareon@users.noreply.github.com> Date: Sat, 29 Jun 2024 13:53:40 +0200 Subject: [PATCH] refactor: github actions and icon --- .github/workflows/ci.yml | 31 +++++++++++++++++++++++++++ .github/workflows/release-action.yml | 32 ++++++++++++++++++++++++---- client/main.lua | 10 ++++++--- fxmanifest.lua | 1 + ui/public/icon.svg | 11 +--------- 5 files changed, 68 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0141439 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: Main CI +on: [push, pull_request] +jobs: + build: + name: Build Test + runs-on: ubuntu-latest + defaults: + run: + working-directory: ui + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup node environment + uses: actions/setup-node@v2 + with: + node-version: 20.x + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn config get cacheFolder)" + - uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install deps + run: yarn --frozen-lockfile + - name: Try build + run: yarn build diff --git a/.github/workflows/release-action.yml b/.github/workflows/release-action.yml index feecf0b..a691619 100644 --- a/.github/workflows/release-action.yml +++ b/.github/workflows/release-action.yml @@ -19,13 +19,37 @@ jobs: - name: Install ZIP run: sudo apt install zip + - name: Install pnpm + uses: pnpm/action-setup@v4.0.0 + with: + version: 9 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: "pnpm" + cache-dependency-path: "ui/pnpm-lock.yaml" + + - name: Install dependencies + run: pnpm i --frozen-lockfile + working-directory: ui + + - name: Run build + run: pnpm build + working-directory: ui + env: + CI: false + - name: Bundle files run: | - rm -rf ./.github ./.vscode ./.git shopt -s extglob - mkdir ./${{ github.event.repository.name }} - cp -r !(${{ github.event.repository.name }}) ${{ github.event.repository.name }} - zip -r ./${{ github.event.repository.name }}.zip ./${{ github.event.repository.name }} + mkdir -p ./temp/${{ github.event.repository.name }} + mkdir -p ./temp/${{ github.event.repository.name }}/ui + cp ./{README.md,LICENSE,fxmanifest.lua} ./temp/${{ github.event.repository.name }} + cp -r ./{client,server} ./temp/${{ github.event.repository.name }} + cp -r ./ui/public ./temp/${{ github.event.repository.name }}/ui/public + cd ./temp && zip -r ../${{ github.event.repository.name }}.zip ./${{ github.event.repository.name }} - name: Get App Token uses: actions/create-github-app-token@v1 diff --git a/client/main.lua b/client/main.lua index ed688a2..fd33bff 100644 --- a/client/main.lua +++ b/client/main.lua @@ -13,9 +13,13 @@ CreateThread(function() developer = 'solareon', defaultApp = true, ui = GetCurrentResourceName() .. "/ui/dist/index.html", - -- ui = "http://localhost:3000", - icon = "https://cfx-nui-" .. GetCurrentResourceName() .. "/ui/dist/icon.svg", - fixBlur = true + -- ui = "http://localhost:3000", -- for local ui build testing + icon = "https://cfx-nui-" .. GetCurrentResourceName() .. "/ui/public/icon.svg", + fixBlur = true, + images = { -- OPTIONAL array of screenshots of the app, used for showcasing the app + "https://cfx-nui-" .. GetCurrentResourceName() .. "/ui/public/screenshot-light.png", + "https://cfx-nui-" .. GetCurrentResourceName() .. "/ui/public/screenshot-dark.png" + }, }) if not added then print('Could not add app:', errorMessage) diff --git a/fxmanifest.lua b/fxmanifest.lua index 0302fe3..5b1b22c 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -18,6 +18,7 @@ shared_script '@ox_lib/init.lua' files { "ui/dist/**/*", + "ui/public/**" } ui_page "ui/dist/index.html" diff --git a/ui/public/icon.svg b/ui/public/icon.svg index 1b8880f..5bec01e 100644 --- a/ui/public/icon.svg +++ b/ui/public/icon.svg @@ -1,10 +1 @@ - - - - - - - - - - + \ No newline at end of file