feat(installer): upgrade multi-platform wizards, custom directory sup… #11
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 | |
| # FULLY AUTOMATED — every push to main. | |
| # CalVer auto-version → Tests → esbuild bundle → pkg binary → Publish. | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| version: | |
| name: Calculate Version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.calver.outputs.version }} | |
| tag: ${{ steps.calver.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 0, fetch-tags: true } | |
| - name: CalVer | |
| id: calver | |
| run: | | |
| Y=$(date +%Y); M=$(date +%-m) | |
| git fetch --tags 2>/dev/null || true | |
| H=0 | |
| for t in $(git tag -l "v${Y}.${M}.*"); do | |
| B=$(echo "$t" | sed "s/v${Y}.${M}.//") | |
| [ "$B" -gt "$H" ] 2>/dev/null && H=$B | |
| done | |
| V="${Y}.${M}.$((H+1))" | |
| echo "version=${V}" >> $GITHUB_OUTPUT | |
| echo "tag=v${V}" >> $GITHUB_OUTPUT | |
| echo "Version: ${V}" | |
| test: | |
| name: Test (Node ${{ matrix.node }}) | |
| runs-on: ubuntu-latest | |
| needs: [ version ] | |
| defaults: { run: { working-directory: ./cloudsync-cli } } | |
| strategy: | |
| matrix: | |
| node: ['lts/*', '*'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: npm | |
| cache-dependency-path: cloudsync-cli/package-lock.json | |
| - run: npm ci | |
| - run: npm test | |
| build-windows: | |
| name: Windows EXE | |
| runs-on: windows-latest | |
| needs: [ test ] | |
| defaults: { run: { working-directory: ./cloudsync-cli } } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: npm | |
| cache-dependency-path: cloudsync-cli/package-lock.json | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npx @yao-pkg/pkg dist/bundle.cjs -t node22-win-x64 -o cloudsync.exe | |
| - run: .\cloudsync.exe --version | |
| - run: | | |
| mkdir release-assets | |
| copy cloudsync.exe release-assets\ | |
| copy installer\CloudSync-Setup.bat release-assets\ | |
| copy installer\CloudSync.iss release-assets\ | |
| copy README.md release-assets\ | |
| copy LICENSE release-assets\ | |
| Compress-Archive -Path release-assets\* -DestinationPath cloudsync-windows-x64.zip | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-build | |
| path: | | |
| cloudsync-cli/cloudsync.exe | |
| cloudsync-cli/cloudsync-windows-x64.zip | |
| cloudsync-cli/installer/CloudSync-Setup.bat | |
| cloudsync-cli/installer/CloudSync.iss | |
| retention-days: 7 | |
| build-linux: | |
| name: Linux Binary | |
| runs-on: ubuntu-latest | |
| needs: [ test ] | |
| defaults: { run: { working-directory: ./cloudsync-cli } } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: npm | |
| cache-dependency-path: cloudsync-cli/package-lock.json | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npx @yao-pkg/pkg dist/bundle.cjs -t node22-linux-x64 -o cloudsync-linux-x64 | |
| - run: chmod +x cloudsync-linux-x64 && ./cloudsync-linux-x64 --version | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-build | |
| path: cloudsync-cli/cloudsync-linux-x64 | |
| retention-days: 7 | |
| build-macos: | |
| name: macOS Binary | |
| runs-on: macos-latest | |
| needs: [ test ] | |
| defaults: { run: { working-directory: ./cloudsync-cli } } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| cache: npm | |
| cache-dependency-path: cloudsync-cli/package-lock.json | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npx @yao-pkg/pkg dist/bundle.cjs -t node22-macos-x64 -o cloudsync-macos-x64 | |
| - run: chmod +x cloudsync-macos-x64 && ./cloudsync-macos-x64 --version | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-build | |
| path: cloudsync-cli/cloudsync-macos-x64 | |
| retention-days: 7 | |
| publish: | |
| name: Publish & Release | |
| runs-on: ubuntu-latest | |
| needs: [ version, build-windows, build-linux, build-macos ] | |
| defaults: { run: { working-directory: ./cloudsync-cli } } | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: { fetch-depth: 0, fetch-tags: true } | |
| - uses: actions/download-artifact@v4 | |
| with: { name: windows-build, path: cloudsync-cli/assets/windows } | |
| - uses: actions/download-artifact@v4 | |
| with: { name: linux-build, path: cloudsync-cli/assets/linux } | |
| - uses: actions/download-artifact@v4 | |
| with: { name: macos-build, path: cloudsync-cli/assets/macos } | |
| - name: Set version | |
| run: | | |
| V=${{ needs.version.outputs.version }} | |
| npm pkg set version=$V | |
| echo "export const VERSION = '$V';" > src/version.mjs | |
| - name: Create git tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add package.json package-lock.json src/version.mjs | |
| git commit -m "release: ${{ needs.version.outputs.version }} [skip ci]" || true | |
| git tag ${{ needs.version.outputs.tag }} | |
| git push origin HEAD:main ${{ needs.version.outputs.tag }} | |
| - name: Setup npm registry | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: npm | |
| cache-dependency-path: cloudsync-cli/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Publish to npm | |
| continue-on-error: true | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Setup GitHub Package Registry | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'lts/*' | |
| registry-url: 'https://npm.pkg.github.com' | |
| scope: '@tech4file' | |
| - name: Publish to GPR (GitHub Packages) | |
| continue-on-error: true | |
| run: | | |
| npm pkg set name="@tech4file/cloudsync-cli" | |
| npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checksums | |
| run: | | |
| mkdir -p assets | |
| cd assets | |
| find . -type f ! -name '*.zip' ! -name '*.bat' ! -name '*.iss' ! -name '*.md' ! -name 'LICENSE' \ | |
| -exec sha256sum {} \; > checksums.txt || true | |
| - name: GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.version.outputs.tag }} | |
| name: ${{ needs.version.outputs.version }} | |
| generate_release_notes: true | |
| files: | | |
| cloudsync-cli/assets/windows/cloudsync.exe | |
| cloudsync-cli/assets/windows/cloudsync-windows-x64.zip | |
| cloudsync-cli/assets/windows/CloudSync-Setup.bat | |
| cloudsync-cli/assets/windows/CloudSync.iss | |
| cloudsync-cli/assets/linux/cloudsync-linux-x64 | |
| cloudsync-cli/assets/macos/cloudsync-macos-x64 | |
| cloudsync-cli/assets/checksums.txt | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |