|
| 1 | +name: Rolling Release - Alpha |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - "frontend/**" |
| 8 | + |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + Build: |
| 13 | + permissions: write-all |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + - name: Set up pnpm |
| 20 | + uses: pnpm/action-setup@v4 |
| 21 | + with: |
| 22 | + version: latest |
| 23 | + - name: Set up Node.js |
| 24 | + uses: actions/setup-node@v4 |
| 25 | + with: |
| 26 | + node-version: "latest" |
| 27 | + cache: "pnpm" |
| 28 | + cache-dependency-path: frontend/pnpm-lock.yaml |
| 29 | + - name: Install dependencies |
| 30 | + run: cd frontend && pnpm install --frozen-lockfile |
| 31 | + - name: Build Frontend |
| 32 | + run: cd frontend && pnpm build-only |
| 33 | + - name: Create a compressed file |
| 34 | + run: | |
| 35 | + git rev-parse --short HEAD | tr -d '\n' > frontend/dist/version.txt |
| 36 | + cd frontend |
| 37 | + mv dist rolling-release-alpha |
| 38 | + zip -r rolling-release-alpha.zip rolling-release-alpha |
| 39 | + - name: Generate Changelog |
| 40 | + run: | |
| 41 | + set +e |
| 42 | + LAST_COMMIT=$(curl -L https://github.com/GUI-for-Cores/GUI.for.Clash/releases/download/rolling-release-alpha/version.txt) |
| 43 | + echo -e "## Change log\n\n> Update time: $(TZ='Asia/Shanghai' date "+%Y-%m-%d %H:%M:%S")\n" > changelog.md |
| 44 | + git log $LAST_COMMIT..HEAD --pretty=format:"* %s" >> changelog.md |
| 45 | + if [ $? -ne 0 ]; then |
| 46 | + echo "No changes found since last commit." >> changelog.md |
| 47 | + fi |
| 48 | + set -e |
| 49 | + - name: Create Release and Upload Assets |
| 50 | + uses: svenstaro/upload-release-action@v2 |
| 51 | + with: |
| 52 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + file: ./{frontend/{rolling-release-alpha.zip,rolling-release-alpha/version.txt},changelog.md} |
| 54 | + file_glob: true |
| 55 | + tag: rolling-release-alpha |
| 56 | + release_name: rolling-release-alpha |
| 57 | + overwrite: true |
| 58 | + draft: false |
| 59 | + prerelease: true |
| 60 | + body: | |
| 61 | + Rolling release built by GitHub Actions. |
| 62 | + To use this version, please install the "Rolling Release Assistant" plugin and enable "Enable Rolling Release" within the app. |
0 commit comments