Skip to content

Build and Release API Server #4

Build and Release API Server

Build and Release API Server #4

name: Build and Release API Server
on:
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
if: github.actor != 'github-actions[bot]'
steps:
# Checkout the code
- uses: actions/checkout@v2
with:
persist-credentials: false # This prevents GitHub Actions from using its token
fetch-depth: 0 # This ensures all history is fetched
# Setup .NET environment
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.x.x'
# Restore project dependencies
- name: Restore dependencies
run: dotnet restore ./Library
# Restore project dependencies
- name: Restore dependencies
run: dotnet restore ./API
# Build the Azure Functions project
- name: Build Azure Functions project
run: |
cd API
dotnet publish -c Release -o publish
# Zip the build output
- name: Zip build output
run: |
publishPath='API/publish'
zip -r VedAstro-API-Server.zip "$publishPath"
# Get shortened commit hash
- name: Get short commit hash
id: vars
run: |
shortSha=${GITHUB_SHA::7}
echo "SHORT_SHA=$shortSha" >> $GITHUB_ENV
# Create Release and Upload Asset
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: VedAstro-API-Server.zip
tag_name: ${{ env.SHORT_SHA }}
name: API Server ${{ env.SHORT_SHA }}
body: |
## How to Use this Release
**👣 Steps:**
1. **Download the `VedAstro-API-Server.zip`** file attached below.
2. **Extract** the contents of the zip file to a directory of your choice.
3. **Open a command prompt or terminal** and navigate to the extracted directory.
4. **Start the Azure Functions host** by running:
```bash
func start
```
Ensure you have the [Azure Functions Core Tools](https://docs.microsoft.com/azure/azure-functions/functions-run-local) installed.
5. **Access your functions** using the URLs provided in the console output.
6. 🎈 Enjoy the world's first open-source, non-profit Vedic astrology API server.
💌 Donate to support the project --> vedastro.org/Donate.html
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} # Automatically provided by GitHub Actions