From 876f66300933d51dfc0c4dc06de4782c72b8b877 Mon Sep 17 00:00:00 2001 From: ErroRExorY Date: Thu, 15 Feb 2024 21:29:23 +0100 Subject: [PATCH] test --- .github/workflows/build-prod.yml | 93 +++++++++++++------------------- 1 file changed, 37 insertions(+), 56 deletions(-) diff --git a/.github/workflows/build-prod.yml b/.github/workflows/build-prod.yml index 3e96a6a..a5e9d14 100644 --- a/.github/workflows/build-prod.yml +++ b/.github/workflows/build-prod.yml @@ -1,4 +1,4 @@ -name: Release +name: Release Workflow on: push: @@ -9,79 +9,60 @@ jobs: create-release: name: Build and Create Tagged Release runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: - - name: Install archive tools - run: sudo apt install zip - - name: Checkout source code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - ref: ${{ github.event.repository.default_branch }} - - name: Setup pnpm - uses: pnpm/action-setup@v2 + - name: Setup node + uses: actions/setup-node@v3 with: - version: 8.15.1 + node-version: 20 + cache: 'npm' + cache-dependency-path: web/package-lock.json - name: Install dependencies - run: cd web && pnpm i - - # - name: Bump package version - # run: npm version ${{ github.ref_name }} - # working-directory: web + run: | + if [ -d "web" ]; then + npm i + working-directory: web + fi - name: Run build - run: pnpm run build - working-directory: web + run: | + if [ -d "web" ]; then + npm run build + working-directory: web + fi env: CI: false - - # - name: Bump manifest version - # run: node .github/actions/bump-manifest-version.js - # env: - # TGT_RELEASE_VERSION: ${{ github.ref_name }} - - # - name: Push manifest change - # uses: EndBug/add-and-commit@v8 - # with: - # add: fxmanifest.lua - # push: true - # author_name: Manifest Bumper - # author_email: 41898282+github-actions[bot]@users.noreply.github.com - # message: 'chore: bump manifest version to ${{ github.ref_name }}' - - - name: Update tag ref - uses: EndBug/latest-tag@latest - with: - ref: ${{ github.ref_name }} + + - name: Create exclude file from input + run: | + echo "node_modules" >> exclude.txt + echo ".git" >> exclude.txt + echo ".github" >> exclude.txt + echo "exclude.txt" >> exclude.txt + echo "temp/" >> exclude.txt - name: Bundle files run: | - ls - mkdir -p ./temp/esx_hud - mkdir -p ./temp/esx_hud/web/ - cp ./{LICENSE,README.md,fxmanifest.lua,config.lua,sv_config.lua} ./temp/esx_hud - cp -r ./{client,server,shared} ./temp/esx_hud - cp -r ./web/dist ./temp/esx_hud/web/ - cd ./temp && zip -r ../esx_hud.zip ./esx_hud + mkdir -p ./temp/release + rsync -av --progress --exclude-from=exclude.txt ./ ./temp/release/ + if [ -d "web/dist" ]; then + mkdir -p ./temp/release/web + cp -r ./web/dist ./temp/release/web/dist + fi + cd ./temp && zip -r ../release.zip ./release - name: Create Release uses: 'marvinpinto/action-automatic-releases@v1.2.1' - id: auto_release with: repo_token: '${{ secrets.GITHUB_TOKEN }}' - title: ${{ env.RELEASE_VERSION }} + automatic_release_tag: ${{ github.ref_name }} prerelease: false - files: esx_hud.zip - - env: - CI: false - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: Publish npm package - # uses: JS-DevTools/npm-publish@v1 - # with: - # token: ${{ secrets.NPM_TOKEN }} - # package: './package/package.json' - # access: 'public' \ No newline at end of file + files: release.zip \ No newline at end of file