Merge branch 'main' of github.com:LedgityLabs/LedgityYield #612
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Release & Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "lts/*" | |
- name: Install Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun_version: latest | |
- name: Install dependencies | |
run: bun i | |
- name: Run Semantic Release | |
id: semantic-release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
res=$(npx semantic-release | { tail -n 1 | grep -q "There are no relevant changes" && echo 0 || echo 1; }) | |
echo "NEW_RELEASE=$res" >> $GITHUB_OUTPUT | |
# Vercel deploy is triggered manually here to: | |
# - ensure it only runs when app code has changed (feat, fix, perf) | |
# - ensure it runs after Semantic Release and so has access to latest sources | |
- name: Trigger Vercel update | |
env: | |
NEW_RELEASE: ${{ steps.semantic-release.outputs.NEW_RELEASE }} | |
run: | | |
if [ $NEW_RELEASE -eq 1 ]; then | |
# If changes are not on hardhat related stuff | |
#if git diff --quiet HEAD^ HEAD -- . ':!hardhat' ':!hardhat.config.ts'; then | |
curl --fail -X POST ${{ secrets.VERCEL_DEPLOY_HOOK }} || exit 1 | |
#fi | |
else | |
echo "No new release, pass." | |
fi |