|
| 1 | +name: release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + tags: |
| 7 | + - v*.*.* |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build: |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - os: ubuntu-latest |
| 16 | + target: x86_64-unknown-linux-gnu |
| 17 | + suffix: "" |
| 18 | + - os: macos-latest |
| 19 | + target: x86_64-apple-darwin |
| 20 | + suffix: "" |
| 21 | + - os: macos-latest |
| 22 | + target: aarch64-apple-darwin |
| 23 | + suffix: "" |
| 24 | + - os: windows-latest |
| 25 | + target: x86_64-pc-windows-msvc |
| 26 | + suffix: ".exe" |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v3 |
| 30 | + - uses: actions-rs/toolchain@v1 |
| 31 | + with: |
| 32 | + toolchain: stable |
| 33 | + profile: minimal |
| 34 | + target: ${{ matrix.target }} |
| 35 | + override: true |
| 36 | + - name: Cache Dependencies |
| 37 | + uses: Swatinem/rust-cache@v1 |
| 38 | + with: |
| 39 | + key: ${{ matrix.target }} |
| 40 | + - uses: actions-rs/cargo@v1 |
| 41 | + with: |
| 42 | + command: build |
| 43 | + args: --target ${{ matrix.target }} --release |
| 44 | + - name: Rename executable |
| 45 | + run: mv target/${{ matrix.target }}/release/svd2rust${{ matrix.suffix }} target/${{ matrix.target }}/release/svd2rust-${{ matrix.target }}${{ matrix.suffix }} |
| 46 | + - uses: actions/upload-artifact@v3 |
| 47 | + with: |
| 48 | + name: svd2rust-${{ matrix.target }} |
| 49 | + path: target/${{ matrix.target }}/release/svd2rust-${{ matrix.target }}${{ matrix.suffix }} |
| 50 | + |
| 51 | + release: |
| 52 | + name: release |
| 53 | + runs-on: ubuntu-latest |
| 54 | + needs: [build] |
| 55 | + steps: |
| 56 | + - uses: actions/download-artifact@v3 |
| 57 | + with: |
| 58 | + path: artifacts |
| 59 | + - run: ls -R ./artifacts |
| 60 | + - uses: softprops/action-gh-release@v1 |
| 61 | + if: ${{ !startsWith(github.ref, 'refs/tags/v') }} |
| 62 | + with: |
| 63 | + prerelease: true |
| 64 | + name: "Pre-release" |
| 65 | + tag_name: "pre-release" |
| 66 | + files: | |
| 67 | + artifacts/**/* |
| 68 | + - uses: softprops/action-gh-release@v1 |
| 69 | + if: startsWith(github.ref, 'refs/tags/v') |
| 70 | + with: |
| 71 | + files: | |
| 72 | + artifacts/**/* |
0 commit comments