Release #8
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: Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| upgrade: | |
| description: Type of version upgrade (patch, minor, major) | |
| required: true | |
| default: patch | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| publish_existing: | |
| description: Publish the version already on master without changing it | |
| required: true | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version: 22 | |
| registry-url: https://registry.npmjs.org/ | |
| package-manager-cache: false | |
| - name: Setup git | |
| if: inputs.publish_existing == false | |
| run: |- | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| - name: Bump version | |
| if: inputs.publish_existing == false | |
| run: npm version ${{ inputs.upgrade }} | |
| - name: Push version | |
| if: inputs.publish_existing == false | |
| run: |- | |
| git push | |
| git push --tags | |
| - run: npm publish | |
| - name: Prepare build | |
| run: npm i -g pkg | |
| - name: Build | |
| run: pkg --out-path build . | |
| - name: Get version and package name | |
| id: get_info | |
| run: |- | |
| version=$(node -p "require('./package.json').version") | |
| echo $version | |
| echo "::set-output name=version::$version" | |
| name=$(node -p "require('./package.json').name") | |
| echo $name | |
| echo "::set-output name=name::$name" | |
| - name: Create Release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.get_info.outputs.version }} | |
| release_name: Release v${{ steps.get_info.outputs.version }} | |
| draft: false | |
| prerelease: false | |
| - name: Upload Linux Binary | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./build/${{ steps.get_info.outputs.name }}-linux | |
| asset_name: ${{ steps.get_info.outputs.name }}-linux | |
| asset_content_type: application/x-executable | |
| - name: Upload MacOS Binary | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./build/${{ steps.get_info.outputs.name }}-macos | |
| asset_name: ${{ steps.get_info.outputs.name }}-macos | |
| asset_content_type: application/x-mach-binary | |
| - name: Upload Windows Binary | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./build/${{ steps.get_info.outputs.name }}-win.exe | |
| asset_name: ${{ steps.get_info.outputs.name }}-win.exe | |
| asset_content_type: application/x-dosexec |