feat: add estimated reading time indicator #33
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: "Semantic release" | |
on: | |
push: | |
branches: | |
- main | |
- alpha | |
- beta | |
- next | |
concurrency: | |
# group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
group: release-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
setup: | |
name: Set environment variables | |
runs-on: ubuntu-latest | |
outputs: | |
DEPLOY_ENVIRONMENT: ${{ steps.env.outputs.DEPLOY_ENVIRONMENT }} | |
DEPLOY_DOMAIN: ${{ steps.env.outputs.DEPLOY_DOMAIN }} | |
VERCEL_ENVIRONMENT: ${{ steps.env.outputs.VERCEL_ENVIRONMENT }} | |
VERCEL_COMMAND: ${{ steps.env.outputs.VERCEL_COMMAND }} | |
steps: | |
- name: "☁️ compute environment variables" | |
id: env | |
run: | | |
echo "DEPLOY_ENVIRONMENT=$([[ ${{ github.ref_name }} == 'main' ]] && echo 'production' || echo ${{ github.ref_name }})" >> $GITHUB_OUTPUT | |
echo "DEPLOY_DOMAIN=$([[ ${{ github.ref_name }} == 'main' ]] && echo 'tmcb.space' || echo "${{ github.ref_name }}.tmcb.space")" >> $GITHUB_OUTPUT | |
echo "VERCEL_ENVIRONMENT=$([[ ${{ github.ref_name }} == 'main' ]] && echo 'production' || echo 'preview')" >> $GITHUB_OUTPUT | |
echo "VERCEL_COMMAND=$([[ ${{ github.ref_name }} == 'main' ]] && echo "--prod" || echo '')" >> $GITHUB_OUTPUT | |
test: | |
name: Test and lint | |
uses: ./.github/workflows/development.yml | |
release: | |
environment: | |
name: ${{ needs.setup.outputs.DEPLOY_ENVIRONMENT }} | |
url: https://github.com/${{ github.repository }}/releases/tag/${{ steps.semantic-release.outputs.release-tag }} | |
outputs: | |
release-tag: ${{ steps.semantic-release.outputs.release-tag }} | |
name: Semantic release | |
needs: | |
- setup | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "🔧 setup node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: "🔧 install npm@latest" | |
run: npm i -g npm@latest | |
- name: "📦 install dependencies" | |
uses: bahmutov/npm-install@v1.8.15 | |
- name: "🚀 release" | |
id: semantic-release | |
uses: tmcb-space/release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
deploy: | |
environment: | |
name: ${{ needs.setup.outputs.DEPLOY_ENVIRONMENT }} | |
url: https://${{ needs.setup.outputs.DEPLOY_DOMAIN }} | |
name: Deploy to Vercel | |
needs: | |
- setup | |
- release | |
runs-on: ubuntu-latest | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
steps: | |
- name: "☁️ checkout repository" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: "🔧 setup node" | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: "🔧 install npm@latest vercel@canary" | |
run: npm i -g npm@latest vercel@canary | |
- name: "📦 Pull Vercel Environment Information" | |
run: npx vercel pull --yes --environment=${{ needs.setup.outputs.VERCEL_ENVIRONMENT }} --token=${{ secrets.VERCEL_TOKEN }} | |
- name: "📦 Pull Vercel Build Environment" | |
run: npx vercel env pull .env.local --token=${{ secrets.VERCEL_TOKEN }} | |
- name: "📂 Build Project Artifacts" | |
run: npx vercel build ${{ needs.setup.outputs.VERCEL_COMMAND }} --token=${{ secrets.VERCEL_TOKEN }} | |
- name: "🚀 Deploy Project Artifacts to Vercel" | |
run: npx vercel deploy --prebuilt ${{ needs.setup.outputs.VERCEL_COMMAND }} --token=${{ secrets.VERCEL_TOKEN }} | |
cleanup: | |
name: Cleanup actions | |
needs: | |
- release | |
runs-on: ubuntu-latest | |
steps: | |
- name: "♻️ remove build artifacts" | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: | | |
docker |