From 394c87ab9b56f3cd37039414c7340abcb1ddc699 Mon Sep 17 00:00:00 2001 From: Ajay Dhangar <99037494+ajay-dhangar@users.noreply.github.com> Date: Fri, 1 Nov 2024 10:23:47 +0530 Subject: [PATCH] Update release.yml --- .github/workflows/release.yml | 53 +++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index de500eb92..ebafbb4c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,26 +1,55 @@ name: Release -permissions: - contents: write - on: push: tags: - - 'v*' + - 'v*.*.*' # Trigger the workflow on tags like v1.0.0, v1.1.0, etc. jobs: release: + name: Build and Release Algo Site runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Checkout repository + uses: actions/checkout@v3 - - name: Set node - uses: actions/setup-node@v4 + - name: Set up Node.js + uses: actions/setup-node@v3 with: - node-version: lts/* + node-version: '16' - - run: npx changelogithub + - name: Install dependencies + run: npm install + + - name: Build Algo site + run: npm run build + + - name: Generate Release Notes + id: release_notes + uses: release-drafter/release-drafter@v5 + with: + config-name: '.github/release-drafter.yml' # Requires a Release Drafter config env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create GitHub Release + id: create_release + uses: ncipollo/release-action@v1 + with: + tag: ${{ github.ref_name }} # Tag name from the push event + release_name: ${{ github.ref_name }} + body: ${{ steps.release_notes.outputs.body }} + draft: false + prerelease: false + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Built Site (Optional) + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: build # Directory containing built static site files (Algo build output) + asset_name: algo-site.zip + asset_content_type: application/zip + + # Optionally, you could add additional jobs here to deploy to GitHub Pages if needed