|
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 |
|
10 | | - windows-binaries: |
| 10 | + create-windows-binaries: |
11 | 11 |
|
12 | 12 | runs-on: windows-latest |
13 | 13 |
|
14 | 14 | steps: |
15 | | - - uses: actions/checkout@v2 |
| 15 | + - uses: actions/checkout@v4 |
16 | 16 |
|
17 | 17 | - name: Install stable |
18 | | - uses: actions-rs/toolchain@v1 |
19 | | - with: |
20 | | - profile: minimal |
21 | | - toolchain: stable |
22 | | - override: true |
| 18 | + uses: dtolnay/rust-toolchain@stable |
23 | 19 |
|
24 | | - - name: Build json-diff |
| 20 | + - name: Build jsons-structural-diff |
25 | 21 | run: | |
26 | 22 | cargo build --release --workspace |
27 | 23 |
|
28 | | - - name: Create zip |
| 24 | + - name: Get the version |
| 25 | + shell: bash |
| 26 | + id: tagName |
29 | 27 | run: | |
30 | | - cd target/release |
31 | | - 7z a ../../json-structural-diff-windows-msvc.zip ` |
32 | | - "json-structural-diff-cli.exe" |
| 28 | + VERSION=$(cargo pkgid | cut -d# -f2) |
| 29 | + echo "tag=$VERSION" >> $GITHUB_OUTPUT |
33 | 30 |
|
34 | | - - name: Upload binaries |
35 | | - uses: actions/upload-artifact@v2 |
| 31 | + - name: Build package |
| 32 | + id: package |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + ARCHIVE_TARGET="x86_64-pc-windows-msvc" |
| 36 | + ARCHIVE_NAME="json-structural-diff-${{ steps.tagName.outputs.tag }}-$ARCHIVE_TARGET" |
| 37 | + ARCHIVE_FILE="${ARCHIVE_NAME}.zip" |
| 38 | + 7z a ${ARCHIVE_FILE} ./target/release/json-structural-diff-cli.exe |
| 39 | + echo "file=$ARCHIVE_FILE" >> $GITHUB_OUTPUT |
| 40 | + echo "name=$ARCHIVE_NAME.zip" >> $GITHUB_OUTPUT |
| 41 | +
|
| 42 | + - name: Upload artifacts |
| 43 | + uses: actions/upload-artifact@v3 |
36 | 44 | with: |
37 | | - name: json-diff-windows-msvc-binaries |
38 | | - path: json-structural-diff-windows-msvc.zip |
| 45 | + name: ${{ steps.package.outputs.name }} |
| 46 | + path: ${{ steps.package.outputs.file }} |
39 | 47 |
|
40 | | - linux-binaries: |
| 48 | + create-unix-binaries: |
41 | 49 |
|
42 | | - runs-on: ubuntu-latest |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + os: [ubuntu-latest, macos-latest] |
| 53 | + include: |
| 54 | + - os: ubuntu-latest |
| 55 | + target: x86_64-unknown-linux-musl |
| 56 | + - os: macos-latest |
| 57 | + target: x86_64-apple-darwin |
43 | 58 |
|
44 | | - steps: |
45 | | - - uses: actions/checkout@v2 |
| 59 | + runs-on: ${{ matrix.os }} |
46 | 60 |
|
47 | | - - name: Install musl-tools |
48 | | - run: | |
49 | | - sudo apt-get install musl-tools |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v4 |
50 | 63 |
|
51 | | - - name: Install Rust stable and musl target |
52 | | - uses: actions-rs/toolchain@v1 |
| 64 | + - name: Install Rust stable |
| 65 | + uses: dtolnay/rust-toolchain@stable |
53 | 66 | with: |
54 | | - profile: minimal |
55 | | - toolchain: stable |
56 | | - target: x86_64-unknown-linux-musl |
57 | | - override: true |
| 67 | + target: ${{ matrix.target }} |
58 | 68 |
|
59 | | - - name: Build json-diff |
| 69 | + - name: Install musl |
| 70 | + if: contains(matrix.target, 'linux-musl') |
60 | 71 | run: | |
61 | | - cargo build --workspace --release --target x86_64-unknown-linux-musl |
| 72 | + sudo apt-get install musl-tools |
62 | 73 |
|
63 | | - - name: Create zip |
| 74 | + - name: Build json-structural-diff |
64 | 75 | 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 |
| 76 | + cargo build --workspace --release --target ${{ matrix.target }} |
79 | 77 |
|
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 |
| 78 | + - name: Strip binary |
91 | 79 | run: | |
92 | | - cargo build --workspace --release |
| 80 | + strip target/${{ matrix.target }}/release/json-structural-diff-cli |
93 | 81 |
|
94 | | - - name: Create zip |
| 82 | + - name: Get the version |
| 83 | + id: tagName |
95 | 84 | 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 |
| 85 | + VERSION=$(cargo pkgid | cut -d# -f2) |
| 86 | + echo "tag=$VERSION" >> $GITHUB_OUTPUT |
100 | 87 |
|
101 | | - - name: Upload binaries |
102 | | - uses: actions/upload-artifact@v2 |
| 88 | + - name: Build package |
| 89 | + id: package |
| 90 | + run: | |
| 91 | + TAR_FILE=json-structural-diff-${{ steps.tagName.outputs.tag }}-${{ matrix.target }} |
| 92 | + cd target/${{ matrix.target }}/release |
| 93 | + tar -czvf $GITHUB_WORKSPACE/$TAR_FILE.tar.gz json-structural-diff-cli |
| 94 | + echo "name=$TAR_FILE" >> $GITHUB_OUTPUT |
| 95 | + echo "file=$TAR_FILE.tar.gz" >> $GITHUB_OUTPUT |
| 96 | +
|
| 97 | + - name: Upload artifacts |
| 98 | + uses: actions/upload-artifact@v3 |
103 | 99 | with: |
104 | | - name: json-diff-macos-binaries |
105 | | - path: json-structural-diff-macos.zip |
| 100 | + name: ${{ steps.package.outputs.name }} |
| 101 | + path: ${{ steps.package.outputs.file }} |
| 102 | + |
106 | 103 |
|
107 | 104 | deploy: |
108 | 105 |
|
109 | | - needs: [windows-binaries, linux-binaries, macos-binaries] |
| 106 | + needs: [create-windows-binaries, create-unix-binaries] |
110 | 107 |
|
111 | 108 | runs-on: ubuntu-latest |
112 | 109 |
|
113 | 110 | 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 }} |
| 111 | + - uses: actions/checkout@v4 |
| 112 | + |
| 113 | + - name: Install Rust stable |
| 114 | + uses: dtolnay/rust-toolchain@stable |
| 115 | + |
| 116 | + - name: Create Cargo.lock |
| 117 | + run: | |
| 118 | + cargo update |
| 119 | +
|
| 120 | + - name: Get version |
| 121 | + id: tagName |
| 122 | + run: | |
| 123 | + VERSION=$(cargo pkgid | cut -d# -f2) |
| 124 | + echo "tag=$VERSION" >> $GITHUB_OUTPUT |
| 125 | +
|
| 126 | + - name: Download artifacts |
| 127 | + uses: actions/download-artifact@v2 |
| 128 | + with: |
| 129 | + path: ./binaries |
| 130 | + |
| 131 | + - name: Create a release |
| 132 | + uses: softprops/action-gh-release@v1 |
| 133 | + with: |
| 134 | + name: v${{ steps.tagName.outputs.tag }} |
| 135 | + files: | |
| 136 | + ./binaries/**/*.zip |
| 137 | + ./binaries/**/*.tar.gz |
| 138 | + env: |
| 139 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments