Add installer configuration file #3
This file contains hidden or 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: Build and Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_bump: | |
| description: 'Version bump type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Bump version | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| git config user.name "GitHub Actions Bot" | |
| git config user.email "actions@github.com" | |
| npm version ${{ github.event.inputs.version_bump }} -m "chore: bump version to %s" | |
| git push | |
| git push --tags | |
| - name: Get version | |
| id: version | |
| run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Build application | |
| run: npm run build:installer | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.version.outputs.VERSION }} | |
| name: Release v${{ steps.version.outputs.VERSION }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| dist/*.exe | |
| dist/latest.yml | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Clean old releases | |
| uses: dev-drprasad/delete-older-releases@v0.3.2 | |
| with: | |
| keep_latest: 5 | |
| delete_tags: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |