Skip to content

Merge pull request #22 from code-with-amirhossein/amir78729-patch-23 #36

Merge pull request #22 from code-with-amirhossein/amir78729-patch-23

Merge pull request #22 from code-with-amirhossein/amir78729-patch-23 #36

Workflow file for this run

# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages
on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "🔧 setup pnpm"
uses: pnpm/action-setup@v3
with:
version: 9
- name: "🔧 setup node"
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
- name: "🔧 setup pages"
uses: actions/configure-pages@v4
- name: "📦 install dependencies"
run: pnpm install
# Set up GitHub Actions caching for Wireit.
- name: "🔌 setup wireit cache"
uses: google/wireit@setup-github-actions-caching/v2
- name: "🧱 build docs"
run: pnpm docs:build
- name: "🗄️ upload pages artifact"
uses: actions/upload-pages-artifact@v3
with:
path: .vitepress/dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: "🚀 deploy to github pages"
id: deployment
uses: actions/deploy-pages@v4
telegram-announcement:
name: 📣 Announcement on Telegram
needs: build
runs-on: ubuntu-latest
steps:
- name: 📦 Extract released packages
id: extract
run: |
REPO="https://github.com/${{ github.repository }}"
echo "${{ github.event.pull_request.body }}" > pr_body.md
# Extract all lines starting with '## '
grep '^## ' pr_body.md | sed 's/^## //' > packages.txt
# Generate HTML list of links to releases
while read -r line; do
ENCODED_TAG=$(echo "$line" | jq -sRr @uri) # encode the tag for URL safety
echo " • <a href=\"$REPO/releases/tag/$ENCODED_TAG\">$line</a>"
done < packages.txt > release_links.html
{
echo "RELEASE_LINKS<<EOF"
cat release_links.html
echo "EOF"
} >> "$GITHUB_ENV"
- name: 💬 Send Telegram Message
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
🚀 <b><a href="https://github.com/${{ github.repository }}">${{ github.repository }}</a></b> was just released!
${{ env.RELEASE_LINKS }}
🔗 PR: <a href="${{ github.event.pull_request.html_url }}"><b>${{ github.event.pull_request.title }}</b>#${{ github.event.pull_request.number }}</a>