Manual Build and Release #156
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: Manual Build and Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'release version' | |
| required: true | |
| default: '0.51.0' | |
| draft: | |
| description: 'mark as draft?' | |
| required: false | |
| default: false | |
| type: boolean | |
| prerelease: | |
| description: 'mark as pre-release?' | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup PNPM | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| cache-dependency-path: | | |
| ./pnpm-lock.yaml | |
| - name: Install XRAYUI dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Test XRAYUI | |
| run: pnpm test | |
| - name: Build XRAYUI | |
| run: pnpm run build | |
| - name: Update XRAYUI Version | |
| env: | |
| XRAYUI_VERSION: ${{ github.event.inputs.version }} | |
| run: | | |
| echo "Updating XRAYUI_VERSION to $XRAYUI_VERSION in /dist/xrayui" | |
| sed -i "s/^XRAYUI_VERSION=.*/XRAYUI_VERSION=\"$XRAYUI_VERSION\"/" dist/xrayui | |
| - name: Archive XRAYUI dist | |
| run: tar --transform 's|^|xrayui/|' -czf asuswrt-merlin-xrayui.tar.gz -C dist . | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: tools/xraydatbuilder/src/go.mod | |
| - name: Build xraydatbuilder | |
| working-directory: tools/xraydatbuilder/src | |
| run: | | |
| chmod +x ./build.sh | |
| ./build.sh | |
| tar -czf ./../../../xrayui-datbuilder.tar.gz -C ../dist . | |
| - name: Read Changelog (Latest Version Only) | |
| id: read_changelog | |
| run: | | |
| echo "Extracting latest changelog entry..." | |
| CHANGELOG=$(awk '/^## \[/{if (found++) exit} found {print}' CHANGELOG.md) | |
| echo "changelog<<EOF" >> $GITHUB_ENV | |
| echo "$CHANGELOG" >> $GITHUB_ENV | |
| echo "" >> $GITHUB_ENV | |
| echo "" >> $GITHUB_ENV | |
| echo " " >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ github.event.inputs.version }} | |
| name: 'Release ${{ github.event.inputs.version }}' | |
| draft: ${{ github.event.inputs.draft == 'true' }} | |
| prerelease: ${{ github.event.inputs.prerelease == 'true' }} | |
| body: ${{ env.changelog }} | |
| generate_release_notes: true | |
| files: | | |
| asuswrt-merlin-xrayui.tar.gz | |
| xrayui-datbuilder.tar.gz |