|
| 1 | +name: deploy |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*.*.*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + |
| 10 | + windows-binaries: |
| 11 | + |
| 12 | + runs-on: windows-latest |
| 13 | + |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Install stable |
| 18 | + uses: actions-rs/toolchain@v1 |
| 19 | + with: |
| 20 | + profile: minimal |
| 21 | + toolchain: stable |
| 22 | + override: true |
| 23 | + |
| 24 | + - name: Build json-diff |
| 25 | + run: | |
| 26 | + cargo build --release --workspace |
| 27 | +
|
| 28 | + - name: Create zip |
| 29 | + run: | |
| 30 | + cd target/release |
| 31 | + 7z a ../../json-structural-diff-windows-msvc.zip ` |
| 32 | + "json-structural-diff-cli.exe" |
| 33 | +
|
| 34 | + - name: Upload binaries |
| 35 | + uses: actions/upload-artifact@v2 |
| 36 | + with: |
| 37 | + name: json-diff-windows-msvc-binaries |
| 38 | + path: json-structural-diff-windows-msvc.zip |
| 39 | + |
| 40 | + linux-binaries: |
| 41 | + |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v2 |
| 46 | + |
| 47 | + - name: Install musl-tools |
| 48 | + run: | |
| 49 | + sudo apt-get install musl-tools |
| 50 | +
|
| 51 | + - name: Install Rust stable and musl target |
| 52 | + uses: actions-rs/toolchain@v1 |
| 53 | + with: |
| 54 | + profile: minimal |
| 55 | + toolchain: stable |
| 56 | + target: x86_64-unknown-linux-musl |
| 57 | + override: true |
| 58 | + |
| 59 | + - name: Build json-diff |
| 60 | + run: | |
| 61 | + cargo build --workspace --release --target x86_64-unknown-linux-musl |
| 62 | +
|
| 63 | + - name: Create zip |
| 64 | + run: | |
| 65 | + cd target/x86_64-unknown-linux-musl/release |
| 66 | + strip json-structural-diff-cli |
| 67 | + tar -czvf $GITHUB_WORKSPACE/json-structural-diff-linux.tar.gz \ |
| 68 | + json-structural-diff-cli |
| 69 | +
|
| 70 | + - name: Upload binaries |
| 71 | + uses: actions/upload-artifact@v2 |
| 72 | + with: |
| 73 | + name: json-diff-linux-binaries |
| 74 | + path: json-structural-diff-linux.tar.gz |
| 75 | + |
| 76 | + macos-binaries: |
| 77 | + |
| 78 | + runs-on: macos-latest |
| 79 | + |
| 80 | + steps: |
| 81 | + - uses: actions/checkout@v2 |
| 82 | + |
| 83 | + - name: Install stable |
| 84 | + uses: actions-rs/toolchain@v1 |
| 85 | + with: |
| 86 | + profile: minimal |
| 87 | + toolchain: stable |
| 88 | + override: true |
| 89 | + |
| 90 | + - name: Build json-diff |
| 91 | + run: | |
| 92 | + cargo build --workspace --release |
| 93 | +
|
| 94 | + - name: Create zip |
| 95 | + run: | |
| 96 | + cd target/release |
| 97 | + strip json-structural-diff-cli |
| 98 | + zip $GITHUB_WORKSPACE/json-structural-diff-macos.zip \ |
| 99 | + json-structural-diff-cli |
| 100 | +
|
| 101 | + - name: Upload binaries |
| 102 | + uses: actions/upload-artifact@v2 |
| 103 | + with: |
| 104 | + name: json-diff-macos-binaries |
| 105 | + path: json-structural-diff-macos.zip |
| 106 | + |
| 107 | + deploy: |
| 108 | + |
| 109 | + needs: [windows-binaries, linux-binaries, macos-binaries] |
| 110 | + |
| 111 | + runs-on: ubuntu-latest |
| 112 | + |
| 113 | + steps: |
| 114 | + - uses: actions/checkout@v2 |
| 115 | + |
| 116 | + - name: Download zip files |
| 117 | + uses: actions/download-artifact@v2 |
| 118 | + |
| 119 | + - name: Create Cargo.lock |
| 120 | + run: | |
| 121 | + cargo update |
| 122 | +
|
| 123 | + - name: Create a release |
| 124 | + uses: softprops/action-gh-release@v1 |
| 125 | + with: |
| 126 | + files: | |
| 127 | + Cargo.lock |
| 128 | + json-diff-linux-binaries/json-structural-diff-linux.tar.gz |
| 129 | + json-diff-macos-binaries/json-structural-diff-macos.zip |
| 130 | + json-diff-windows-msvc-binaries/json-structural-diff-windows-msvc.zip |
| 131 | + env: |
| 132 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments