feat: auto-update — silent download, update banner, install on restart #4
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 & Release | |
| on: | |
| push: | |
| branches: [master] | |
| permissions: | |
| contents: write | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| release: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - name: Read version from package.json | |
| id: version | |
| shell: bash | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Check if tag already exists | |
| id: check_tag | |
| shell: bash | |
| env: | |
| TAG: ${{ steps.version.outputs.tag }} | |
| run: | | |
| if git rev-parse "$TAG" >/dev/null 2>&1; then | |
| echo "exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Skip if already released | |
| if: steps.check_tag.outputs.exists == 'true' | |
| shell: bash | |
| run: echo "Tag ${{ steps.version.outputs.tag }} already exists — skipping release" | |
| - run: npm ci | |
| if: steps.check_tag.outputs.exists == 'false' | |
| - name: Build installer | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: npm run build:installer | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build portable | |
| if: steps.check_tag.outputs.exists == 'false' | |
| run: npm run build:portable | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create tag | |
| if: steps.check_tag.outputs.exists == 'false' | |
| shell: bash | |
| env: | |
| TAG: ${{ steps.version.outputs.tag }} | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| git tag "$TAG" | |
| git push origin "$TAG" | |
| - name: Create GitHub Release | |
| if: steps.check_tag.outputs.exists == 'false' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: GateControl ${{ steps.version.outputs.tag }} | |
| generate_release_notes: true | |
| files: | | |
| dist/*.exe | |
| dist/*.zip |