Skip to content

Commit

Permalink
refactor: github actions and icon
Browse files Browse the repository at this point in the history
  • Loading branch information
solareon committed Jun 29, 2024
1 parent 8653dce commit 6bbad55
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 17 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
32 changes: 28 additions & 4 deletions .github/workflows/release-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,37 @@ jobs:
- name: Install ZIP
run: sudo apt install zip

- name: Install pnpm
uses: pnpm/[email protected]
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
Expand Down
10 changes: 7 additions & 3 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ shared_script '@ox_lib/init.lua'

files {
"ui/dist/**/*",
"ui/public/**"
}

ui_page "ui/dist/index.html"
Expand Down
11 changes: 1 addition & 10 deletions ui/public/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6bbad55

Please sign in to comment.