From 8ae15a1caf0fd0815a75c931ac951fb09c553845 Mon Sep 17 00:00:00 2001 From: Shaharia Azam Date: Sun, 6 Apr 2025 16:24:24 +0200 Subject: [PATCH 1/2] Add build workflow and release automation. Introduce a new build job in the CI workflow to handle building and uploading artifacts. Additionally, create a release workflow triggered on new releases to package and upload release assets for distribution. --- .github/workflows/CI.yml | 28 +++++++++++++++++++++++++- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d03a44b..0e27a6f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -49,4 +49,30 @@ jobs: run: npm ci - name: Run linting - run: npm run lint \ No newline at end of file + run: npm run lint + + build: + name: build + needs: [test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build frontend + run: npm run build + + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + retention-days: 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1e579cd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release + +on: + release: + types: [created] + +jobs: + build-and-upload: + name: Build and Upload Release Assets + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Build frontend + run: npm run build + + - name: Zip dist directory + run: zip -r dist.zip dist + + - name: Upload dist as release asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./dist.zip + asset_name: dist.zip + asset_content_type: application/zip \ No newline at end of file From 7d99e6fb379a8790db0fe58da157cebd358b5687 Mon Sep 17 00:00:00 2001 From: Shaharia Azam Date: Sun, 6 Apr 2025 16:29:13 +0200 Subject: [PATCH 2/2] Set permissions to write for release workflow Updated the release workflow to include `contents: write` permissions. This change ensures that the workflow has adequate permissions to perform release-related actions like uploading assets. --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e579cd..aaa0c2b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,9 @@ on: release: types: [created] +permissions: + contents: write + jobs: build-and-upload: name: Build and Upload Release Assets