|
1 | | ---- |
2 | 1 | name: CI/CD Pipeline |
3 | 2 |
|
4 | 3 | on: |
|
19 | 18 | strategy: |
20 | 19 | fail-fast: false |
21 | 20 | matrix: |
22 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
| 21 | + os: [ubuntu-22.04, macos-latest, windows-latest] |
23 | 22 | include: |
24 | | - - os: ubuntu-latest |
| 23 | + - os: ubuntu-22.04 |
25 | 24 | target: wasm32-unknown-unknown |
26 | 25 | platform: web |
27 | 26 | - os: macos-latest |
|
60 | 59 | args: dioxus-cli --force |
61 | 60 |
|
62 | 61 | - name: Install Linux dependencies |
63 | | - if: matrix.os == 'ubuntu-latest' |
| 62 | + if: matrix.os == 'ubuntu-22.04' |
64 | 63 | run: | |
65 | 64 | sudo apt-get update |
66 | 65 | sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf |
@@ -121,177 +120,5 @@ jobs: |
121 | 120 | release: |
122 | 121 | name: Create Release |
123 | 122 | needs: build-and-test |
124 | | - if: startsWith(github.ref, 'refs/tags/v') |
125 | | - runs-on: ubuntu-latest |
126 | | - steps: |
127 | | - - name: Checkout repository |
128 | | - uses: actions/checkout@v4 |
129 | | - |
130 | | - - name: Download all artifacts |
131 | | - uses: actions/download-artifact@v4 |
132 | | - with: |
133 | | - path: artifacts |
134 | | - |
135 | | - - name: Prepare release assets |
136 | | - run: | |
137 | | - mkdir -p release-assets |
138 | | -
|
139 | | - # Web (WASM) |
140 | | - if [ -d "artifacts/opensvm-dioxus-ubuntu-latest-web/web" ]; then |
141 | | - cd artifacts/opensvm-dioxus-ubuntu-latest-web/web |
142 | | - zip -r ../../../release-assets/opensvm-dioxus-web.zip . |
143 | | - cd ../../.. |
144 | | - fi |
145 | | -
|
146 | | - # macOS |
147 | | - if [ -d "artifacts/opensvm-dioxus-macos-latest-desktop/desktop" ]; then |
148 | | - cd artifacts/opensvm-dioxus-macos-latest-desktop/desktop |
149 | | - zip -r ../../../release-assets/opensvm-dioxus-macos.zip . |
150 | | - cd ../../.. |
151 | | - fi |
152 | | -
|
153 | | - # Windows |
154 | | - if [ -d "artifacts/opensvm-dioxus-windows-latest-desktop/desktop" ]; then |
155 | | - cd artifacts/opensvm-dioxus-windows-latest-desktop/desktop |
156 | | - zip -r ../../../release-assets/opensvm-dioxus-windows.zip . |
157 | | - cd ../../.. |
158 | | - fi |
159 | | - shell: bash |
160 | | - |
161 | | - - name: Create GitHub Release |
162 | | - id: create_release |
163 | | - uses: softprops/action-gh-release@v1 |
164 | | - with: |
165 | | - files: release-assets/* |
166 | | - draft: false |
167 | | - prerelease: false |
168 | | - generate_release_notes: true |
169 | | - env: |
170 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
171 | | - |
172 | | - homebrew: |
173 | | - name: Update Homebrew Formula |
174 | | - needs: release |
175 | | - if: startsWith(github.ref, 'refs/tags/v') |
176 | | - runs-on: macos-latest |
177 | | - steps: |
178 | | - - name: Checkout repository |
179 | | - uses: actions/checkout@v4 |
180 | | - |
181 | | - - name: Set up Git |
182 | | - run: | |
183 | | - git config --global user.name "GitHub Actions" |
184 | | - git config --global user.email "[email protected]" |
185 | | -
|
186 | | - - name: Download macOS artifact |
187 | | - uses: actions/download-artifact@v4 |
188 | | - with: |
189 | | - name: opensvm-dioxus-macos-latest-desktop |
190 | | - path: macos-artifact |
191 | | - |
192 | | - - name: Create Homebrew Formula |
193 | | - run: | |
194 | | - VERSION=${GITHUB_REF#refs/tags/v} |
195 | | - DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/v${VERSION}/opensvm-dioxus-macos.zip" |
196 | | -
|
197 | | - # Calculate SHA256 |
198 | | - curl -L -o opensvm-dioxus-macos.zip "$DOWNLOAD_URL" |
199 | | - SHA256=$(shasum -a 256 opensvm-dioxus-macos.zip | awk '{print $1}') |
200 | | -
|
201 | | - # Create formula directory if it doesn't exist |
202 | | - mkdir -p Formula |
203 | | -
|
204 | | - # Create or update formula file |
205 | | - cat > Formula/opensvm-dioxus.rb << EOF |
206 | | - class OpensvmDioxus < Formula |
207 | | - desc "OpenSVM Dioxus application for Solana blockchain ecosystem" |
208 | | - homepage "https://github.com/${{ github.repository }}" |
209 | | - url "$DOWNLOAD_URL" |
210 | | - sha256 "$SHA256" |
211 | | - version "$VERSION" |
212 | | -
|
213 | | - def install |
214 | | - libexec.install Dir["*"] |
215 | | - bin.install_symlink libexec/"opensvm-dioxus" |
216 | | - end |
217 | | - end |
218 | | - EOF |
219 | | -
|
220 | | - # Create a new branch |
221 | | - git checkout -b update-homebrew-formula-v$VERSION |
222 | | -
|
223 | | - # Commit and push changes |
224 | | - git add Formula/opensvm-dioxus.rb |
225 | | - git commit -m "Update Homebrew formula to v$VERSION" |
226 | | - git push origin update-homebrew-formula-v$VERSION |
227 | | -
|
228 | | - # Create pull request |
229 | | - gh pr create --title "Update Homebrew formula to v$VERSION" --body "Updates the Homebrew formula for opensvm-dioxus to version $VERSION" --base main --head update-homebrew-formula-v$VERSION |
230 | | - env: |
231 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
232 | | - |
233 | | - android-build: |
234 | | - name: Build Android |
235 | | - runs-on: ubuntu-latest |
236 | | - if: github.event_name == 'push' |
237 | | - steps: |
238 | | - - name: Checkout repository |
239 | | - uses: actions/checkout@v4 |
240 | | - |
241 | | - - name: Set up JDK |
242 | | - uses: actions/setup-java@v4 |
243 | | - with: |
244 | | - distribution: 'temurin' |
245 | | - java-version: '17' |
246 | | - |
247 | | - - name: Install Rust toolchain |
248 | | - uses: actions-rs/toolchain@v1 |
249 | | - with: |
250 | | - profile: minimal |
251 | | - toolchain: stable |
252 | | - override: true |
253 | | - target: aarch64-linux-android |
254 | | - |
255 | | - - name: Install Android SDK |
256 | | - uses: android-actions/setup-android@v2 |
257 | | - |
258 | | - - name: Install Dioxus CLI |
259 | | - uses: actions-rs/cargo@v1 |
260 | | - with: |
261 | | - command: install |
262 | | - args: dioxus-cli --force |
263 | | - |
264 | | - - name: Cache dependencies |
265 | | - uses: actions/cache@v4 |
266 | | - with: |
267 | | - path: | |
268 | | - ~/.cargo/registry |
269 | | - ~/.cargo/git |
270 | | - opensvm-dioxus/target |
271 | | - key: android-cargo-${{ hashFiles('**/Cargo.lock') }} |
272 | | - restore-keys: android-cargo- |
273 | | - |
274 | | - - name: Build for Android |
275 | | - run: | |
276 | | - cd opensvm-dioxus |
277 | | - RUSTFLAGS="-C opt-level=3 -C lto=thin" dioxus build --features android --platform android --release |
278 | | -
|
279 | | - - name: Optimize APK |
280 | | - run: | |
281 | | - cd opensvm-dioxus/dist/android |
282 | | - $ANDROID_HOME/build-tools/33.0.0/zipalign -v -p 4 app-release-unsigned.apk app-release-aligned.apk |
283 | | - $ANDROID_HOME/build-tools/33.0.0/apksigner sign --ks debug.keystore --ks-pass pass:android --key-pass pass:android --out opensvm-dioxus.apk app-release-aligned.apk |
284 | | -
|
285 | | - - name: Upload Android artifact |
286 | | - uses: actions/upload-artifact@v4 |
287 | | - with: |
288 | | - name: opensvm-dioxus-android |
289 | | - path: opensvm-dioxus/dist/android/opensvm-dioxus.apk |
290 | | - |
291 | | - - name: Add Android APK to release |
292 | | - if: startsWith(github.ref, 'refs/tags/v') |
293 | | - uses: softprops/action-gh-release@v1 |
294 | | - with: |
295 | | - files: opensvm-dioxus/dist/android/opensvm-dioxus.apk |
296 | | - env: |
297 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 123 | + if: startsWith(github.ref](#) |
| 124 | + |
0 commit comments