Skip to content

Commit

Permalink
Update release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay-dhangar authored Nov 1, 2024
1 parent 4017390 commit 394c87a
Showing 1 changed file with 41 additions and 12 deletions.
53 changes: 41 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 394c87a

Please sign in to comment.