From 9a0cde4789dd5d4e773efc88ab09d50cc88f95d3 Mon Sep 17 00:00:00 2001 From: zlayine Date: Mon, 25 Mar 2024 21:37:19 +0000 Subject: [PATCH] add release action --- .github/workflows/build_release.yml | 48 +++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 16 +++++----- resources/js/config.json.default | 6 ++++ 3 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/build_release.yml create mode 100644 resources/js/config.json.default diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml new file mode 100644 index 0000000..2a8fa5a --- /dev/null +++ b/.github/workflows/build_release.yml @@ -0,0 +1,48 @@ +name: Upload Release Asset +on: + push: + tags: + - 'v*' + +jobs: + build: + name: Upload Release Asset + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '18' + cache: 'npm' + - name: Install dependencies + run: npm install + - name: Copy config.json + run: | + cp ./resources/js/config.json.default ./resources/js/config.json + - name: Build project + run: npm run prod-laravel + - name: Install zip + uses: montudor/action-zip@v1 + - name: Zip output + run: zip -qq -r build.zip public/build + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./build.zip + asset_name: build.zip + asset_content_type: application/zip diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7ee7c35..43e29f0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,11 +1,11 @@ name: Build App on: - pull_request: - paths-ignore: - - '**.md' - push: - paths-ignore: - - '**.md' + pull_request: + paths-ignore: + - '**.md' + push: + paths-ignore: + - '**.md' jobs: build: @@ -21,8 +21,8 @@ jobs: run: npm install - name: Copy config.json run: | - cp ./resources/js/config.json.example ./resources/js/config.json - - name: Build static project + cp ./resources/js/config.json.default ./resources/js/config.json + - name: Build project run: npm run prod-laravel - name: Archive build artifacts uses: actions/upload-artifact@v2 diff --git a/resources/js/config.json.default b/resources/js/config.json.default new file mode 100644 index 0000000..c62ecd7 --- /dev/null +++ b/resources/js/config.json.default @@ -0,0 +1,6 @@ +{ + "route": "/", + "tenant": "false", + "websocket": "", + "channel": "" +}