|
8 | 8 | jobs: |
9 | 9 | build-windows: |
10 | 10 | runs-on: windows-latest |
| 11 | + outputs: |
| 12 | + version: ${{ steps.get-version.outputs.version }} |
11 | 13 | steps: |
12 | 14 | - name: Checkout |
13 | 15 | uses: actions/checkout@v4 |
| 16 | + - name: Setup Rust |
| 17 | + uses: actions-rs/toolchain@v1 |
| 18 | + with: |
| 19 | + toolchain: stable |
| 20 | + override: true |
14 | 21 | - name: Setup Node.js |
15 | 22 | uses: actions/setup-node@v4 |
16 | 23 | with: |
17 | 24 | node-version: 20 |
18 | | - - name: Install dependencies |
19 | | - run: | |
20 | | - npm add -g pnpm postject |
21 | | - pnpm install |
| 25 | + - name: Install cargo-make |
| 26 | + run: cargo install cargo-make |
22 | 27 | - name: Build Windows |
23 | | - run: pnpm build |
| 28 | + run: cargo make build |
24 | 29 | - name: Compress Windows Artifact |
25 | | - run: Compress-Archive -Path dist/Git_Commit_Analytics_win.exe -DestinationPath Git_Commit_Analytics_win.zip |
| 30 | + run: | |
| 31 | + Compress-Archive -Path target/release/git-commit-analytics.exe -DestinationPath git-commit-analytics_win.zip |
26 | 32 | - name: Upload Windows Artifact |
27 | 33 | uses: actions/upload-artifact@v4 |
28 | 34 | with: |
29 | 35 | name: windows-build |
30 | | - path: Git_Commit_Analytics_win.zip |
| 36 | + path: git-commit-analytics_win.zip |
31 | 37 |
|
32 | 38 | build-mac: |
33 | 39 | runs-on: macos-latest |
| 40 | + outputs: |
| 41 | + version: ${{ steps.get-version.outputs.version }} |
34 | 42 | steps: |
35 | 43 | - name: Checkout |
36 | 44 | uses: actions/checkout@v4 |
| 45 | + - name: Setup Rust |
| 46 | + uses: actions-rs/toolchain@v1 |
| 47 | + with: |
| 48 | + toolchain: stable |
| 49 | + override: true |
37 | 50 | - name: Setup Node.js |
38 | 51 | uses: actions/setup-node@v4 |
39 | 52 | with: |
40 | 53 | node-version: 20 |
41 | | - - name: Install dependencies |
42 | | - run: | |
43 | | - npm add -g pnpm postject |
44 | | - pnpm install |
| 54 | + - name: Install cargo-make |
| 55 | + run: cargo install cargo-make |
45 | 56 | - name: Build macOS |
46 | | - run: pnpm build |
| 57 | + run: cargo make build |
47 | 58 | - name: Compress macOS Artifact |
48 | | - run: zip --junk-paths Git_Commit_Analytics_mac.zip dist/Git_Commit_Analytics_mac |
| 59 | + run: | |
| 60 | + zip --junk-paths git-commit-analytics_mac.zip target/release/git-commit-analytics |
49 | 61 | - name: Upload macOS Artifact |
50 | 62 | uses: actions/upload-artifact@v4 |
51 | 63 | with: |
52 | 64 | name: mac-build |
53 | | - path: Git_Commit_Analytics_mac.zip |
| 65 | + path: git-commit-analytics_mac.zip |
54 | 66 |
|
55 | | - assets: |
| 67 | + release: |
56 | 68 | runs-on: ubuntu-latest |
57 | 69 | needs: [build-windows, build-mac] |
58 | 70 | steps: |
59 | 71 | - name: Checkout |
60 | 72 | uses: actions/checkout@v4 |
| 73 | + - name: Setup Node.js |
| 74 | + uses: actions/setup-node@v4 |
| 75 | + with: |
| 76 | + node-version: 20 |
| 77 | + - name: Install semantic-release and plugins |
| 78 | + run: | |
| 79 | + npm install -g semantic-release @semantic-release/changelog @semantic-release/git @semantic-release/github |
61 | 80 | - name: Download Windows Artifact |
62 | 81 | uses: actions/download-artifact@v4 |
63 | 82 | with: |
64 | 83 | name: windows-build |
65 | | - path: dist/ |
| 84 | + path: artifacts/ |
66 | 85 | - name: Download macOS Artifact |
67 | 86 | uses: actions/download-artifact@v4 |
68 | 87 | with: |
69 | 88 | name: mac-build |
70 | | - path: dist/ |
| 89 | + path: artifacts/ |
71 | 90 | - name: Prepare Assets |
72 | 91 | run: | |
73 | | - ls -lah dist/ |
74 | | - - name: Upload Final Assets |
75 | | - uses: actions/upload-artifact@v4 |
76 | | - with: |
77 | | - name: final-assets |
78 | | - path: dist/ |
79 | | - |
80 | | - release: |
81 | | - runs-on: ubuntu-latest |
82 | | - needs: [assets] |
83 | | - steps: |
84 | | - - name: Checkout |
85 | | - uses: actions/checkout@v4 |
86 | | - - name: Setup Node.js |
87 | | - uses: actions/setup-node@v4 |
88 | | - with: |
89 | | - node-version: 20 |
90 | | - - name: Install dependencies |
| 92 | + ls -lah artifacts/ |
| 93 | + - name: Rename Artifacts with Version |
91 | 94 | run: | |
92 | | - npm add -g pnpm |
93 | | - pnpm install |
94 | | - - name: Download Final Assets |
95 | | - uses: actions/download-artifact@v4 |
96 | | - with: |
97 | | - name: final-assets |
98 | | - path: ./ |
99 | | - - name: List Files |
100 | | - run: ls -lah |
| 95 | + VERSION=$(npx semantic-release --dry-run | grep -oP 'next release version is \K[0-9]+\.[0-9]+\.[0-9]+') |
| 96 | + echo "Version detected: $VERSION" |
| 97 | + mv artifacts/git-commit-analytics_win.zip artifacts/git-commit-analytics_v${VERSION}_win.zip |
| 98 | + mv artifacts/git-commit-analytics_mac.zip artifacts/git-commit-analytics_v${VERSION}_mac.zip |
101 | 99 | - name: Release |
102 | 100 | env: |
103 | 101 | GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |
104 | | - run: pnpm exec semantic-release |
| 102 | + run: | |
| 103 | + semantic-release |
0 commit comments