From 3c148156226b2c73de626310c557cfc657462742 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/deploy.yml | 51 +++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7ee7c35..7f39dc4 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,11 +21,44 @@ 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.example ./resources/js/config.json + - name: Build project run: npm run prod-laravel - name: Archive build artifacts uses: actions/upload-artifact@v2 with: name: build - path: dist + path: public + release: + if: github.ref == 'refs/heads/master' + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Download build artifact + uses: actions/download-artifact@v2 + with: + name: 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 }} + body: | + Release of ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload Release Artifact + 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: ./public/build + asset_name: build.zip + asset_content_type: application/zip