|
| 1 | +name: Release Binaries |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +env: |
| 8 | + CARGO_TERM_COLOR: always |
| 9 | + |
| 10 | +jobs: |
| 11 | + upload-mac-universal-bin: |
| 12 | + runs-on: macos-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Build macOS binaries |
| 17 | + run: cargo build --release --target aarch64-apple-darwin --target x86_64-apple-darwin |
| 18 | + |
| 19 | + - name: Create universal binary and upload |
| 20 | + run: | |
| 21 | + # Combine intel and m1 binaries into a single universal binary |
| 22 | + lipo -create -output target/pks target/aarch64-apple-darwin/release/pks target/x86_64-apple-darwin/release/pks |
| 23 | +
|
| 24 | + # Create tarball for homebrew |
| 25 | + tar -czf target/pks-mac.tar.gz -C target pks |
| 26 | +
|
| 27 | + # Upload to release |
| 28 | + gh release upload ${{ github.event.release.tag_name }} target/pks-mac.tar.gz |
| 29 | + env: |
| 30 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 31 | + |
| 32 | + upload-linux-bin: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Install cross |
| 38 | + run: cargo install cross |
| 39 | + |
| 40 | + - name: Build linux binaries |
| 41 | + run: | |
| 42 | + cross build --release --target x86_64-unknown-linux-gnu |
| 43 | + cross build --release --target aarch64-unknown-linux-gnu |
| 44 | +
|
| 45 | + - name: Upload linux binaries |
| 46 | + run: | |
| 47 | + tar -czf target/x86_64-unknown-linux-gnu.tar.gz -C target/x86_64-unknown-linux-gnu/release pks |
| 48 | + tar -czf target/aarch64-unknown-linux-gnu.tar.gz -C target/aarch64-unknown-linux-gnu/release pks |
| 49 | + gh release upload ${{ github.event.release.tag_name }} target/x86_64-unknown-linux-gnu.tar.gz |
| 50 | + gh release upload ${{ github.event.release.tag_name }} target/aarch64-unknown-linux-gnu.tar.gz |
| 51 | + env: |
| 52 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + |
| 54 | + generate-dotslash-files: |
| 55 | + name: Generate DotSlash files |
| 56 | + needs: |
| 57 | + - upload-linux-bin |
| 58 | + - upload-mac-universal-bin |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + |
| 63 | + - uses: facebook/dotslash-publish-release@v1 |
| 64 | + env: |
| 65 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 66 | + with: |
| 67 | + config: .github/workflows/dotslash-config.json |
| 68 | + tag: ${{ github.event.release.tag_name }} |
0 commit comments