Skip to content

Build and Release #3181

Build and Release

Build and Release #3181

Workflow file for this run

name: Build and Release
permissions:
contents: write
on:
workflow_dispatch:
schedule:
- cron: '0 */1 * * *'
jobs:
build:
if: |
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'schedule' && github.ref == 'refs/heads/main')
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Get release version
id: get_version
run: echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
- name: Check release version
run: echo "Release version is ${{ steps.get_version.outputs.version }}"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
- name: Install dependencies
run: npm install --production
- name: Type check
run: npm run check
- name: Build project
run: npm run build
- name: Read release note
id: read_release
shell: bash
run: |
r=$(cat RELEASE.md)
r="${r//'%'/'%25'}"
r="${r//$'\n'/'%0A'}"
r="${r//$'\r'/'%0D'}"
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT
- name: Upload Release Assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
tag: v${{ steps.get_version.outputs.version }}
release_name: Release v${{ steps.get_version.outputs.version }}
overwrite: true
file_glob: true
prerelease: ${{ github.ref != 'refs/heads/main' }}
promote: ${{ github.ref == 'refs/heads/main' }}
make_latest: ${{ github.ref == 'refs/heads/main' }}
body: ${{ steps.read_release.outputs.RELEASE_BODY }}