|
1 |
| -name: Build Release |
| 1 | +name: Release |
| 2 | + |
2 | 3 | on:
|
3 | 4 | push:
|
4 | 5 | tags:
|
5 |
| - - v* |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +env: |
| 9 | + CARGO_TERM_COLOR: always |
| 10 | + |
6 | 11 | jobs:
|
7 |
| - create-release: |
8 |
| - runs-on: ubuntu-20.04 |
9 |
| - steps: |
10 |
| - - name: Create Release |
11 |
| - uses: ncipollo/release-action@v1 |
12 |
| - with: |
13 |
| - allowUpdates: true |
14 |
| - omitBody: true |
15 |
| - prerelease: true |
16 |
| - draft: true |
17 |
| - token: ${{ secrets.ACCESS_TOKEN }} |
18 | 12 | build:
|
| 13 | + name: Build |
19 | 14 | runs-on: ${{ matrix.target.os }}
|
20 |
| - needs: create-release |
21 | 15 | strategy:
|
22 |
| - fail-fast: false |
23 | 16 | matrix:
|
24 | 17 | target:
|
25 |
| - - os: ubuntu-20.04 |
| 18 | + - os: ubuntu-latest |
26 | 19 | triple: x86_64-unknown-linux-gnu
|
27 |
| - - os: macos-11 |
| 20 | + - os: macos-latest |
28 | 21 | triple: x86_64-apple-darwin
|
29 |
| - - os: macos-11 |
30 |
| - triple: aarch64-apple-darwin |
31 |
| - - os: windows-2019 |
| 22 | + - os: windows-latest |
32 | 23 | triple: x86_64-pc-windows-msvc
|
33 |
| - features: ['static-link', 'static-link,nozlib'] |
| 24 | + features: [ 'build-assimp', 'static-link' ] |
34 | 25 | steps:
|
35 | 26 | - name: Checkout
|
36 |
| - uses: actions/checkout@v2 |
| 27 | + uses: actions/checkout@v3 |
37 | 28 | with:
|
38 | 29 | submodules: true
|
39 |
| - - name: Install rust |
40 |
| - uses: actions-rs/toolchain@v1 |
41 |
| - with: |
42 |
| - toolchain: stable |
43 |
| - override: true |
44 |
| - - name: Install dependencies (Linux) |
| 30 | + |
| 31 | + # LLVM comes preinstalled on Windows and macOS runners. |
| 32 | + - name: Install LLVM |
45 | 33 | if: runner.os == 'Linux'
|
46 |
| - run: | |
47 |
| - sudo apt-get update |
48 |
| - sudo apt-get install ninja-build |
49 |
| - - name: Install LLVM (Windows) # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797 |
50 | 34 | uses: KyleMayes/install-llvm-action@v1
|
51 |
| - if: runner.os == 'Windows' |
52 | 35 | with:
|
53 |
| - version: '11.0' |
54 | 36 | directory: ${{ runner.temp }}/llvm
|
55 |
| - - name: Install dependencies (macOS) |
56 |
| - if: runner.os == 'macOS' |
| 37 | + cached: true |
| 38 | + version: '14.0' |
| 39 | + |
| 40 | + # CMake and Rust are preinstalled on all runners. |
| 41 | + |
| 42 | + - name: Update Rust |
57 | 43 | run: |
|
58 |
| - brew install ninja |
59 |
| - - name: Install Rust target ${{ matrix.target.triple }} |
60 |
| - run: | |
61 |
| - rustup target add ${{ matrix.target.triple }} |
62 |
| - - name: Build ${{ matrix.target.triple }} |
| 44 | + rustup default stable |
| 45 | +
|
| 46 | + - name: Cache Rust |
| 47 | + uses: Swatinem/rust-cache@v2 |
| 48 | + |
| 49 | + - name: Build |
| 50 | + run: cargo build --target ${{ matrix.target.triple }} --features ${{ matrix.features }} |
| 51 | + |
| 52 | + - name: Package Assimp |
| 53 | + run: cargo run --bin package --target ${{ matrix.target.triple }} --bin package --features ${{ matrix.features }} |
63 | 54 | env:
|
64 |
| - RUSSIMP_BUILD_CACHE_DIR: ${{ runner.temp }}/release |
65 |
| - RUSSIMP_BUILD_OUT_DIR: ${{ runner.temp }}/out |
66 |
| - RUSSIMP_PREBUILT: OFF |
67 |
| - run: | |
68 |
| - cargo build -vv --release --no-default-features --features ${{ matrix.features }} --target ${{ matrix.target.triple }} |
69 |
| - shell: bash |
70 |
| - - name: Upload release |
71 |
| - uses: ncipollo/release-action@v1 |
| 55 | + RUSSIMP_PACKAGE_DIR: ./russimp-package |
| 56 | + |
| 57 | + - name: Upload artifacts |
| 58 | + uses: actions/upload-artifact@v3 |
72 | 59 | with:
|
73 |
| - allowUpdates: true |
74 |
| - artifacts: ${{ runner.temp }}/release/* |
75 |
| - artifactContentType: application/gzip |
76 |
| - artifactErrorsFailBuild: true |
77 |
| - omitBodyDuringUpdate: true |
78 |
| - omitNameDuringUpdate: true |
79 |
| - prerelease: true |
80 |
| - draft: true |
81 |
| - token: ${{ secrets.ACCESS_TOKEN }} |
82 |
| - publish-release: |
83 |
| - runs-on: ubuntu-20.04 |
| 60 | + name: russimp-packages |
| 61 | + path: ${{ env.RUSSIMP_PACKAGE_DIR }}/* |
| 62 | + env: |
| 63 | + RUSSIMP_PACKAGE_DIR: ./russimp-package |
| 64 | + |
| 65 | + publish: |
| 66 | + name: Publish Release |
84 | 67 | needs: build
|
| 68 | + runs-on: ubuntu-latest |
85 | 69 | steps:
|
86 |
| - - name: Publish Release |
87 |
| - uses: ncipollo/release-action@v1 |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v3 |
88 | 72 | with:
|
89 |
| - allowUpdates: true |
90 |
| - omitBody: true |
91 |
| - token: ${{ secrets.ACCESS_TOKEN }} |
92 |
| - cargo-publish: |
93 |
| - needs: publish-release |
94 |
| - env: |
95 |
| - CRATESIO_TOKEN: ${{ secrets.CRATESIO_TOKEN }} |
96 |
| - runs-on: ubuntu-20.04 |
97 |
| - steps: |
98 |
| - - uses: actions/checkout@v2 |
99 |
| - - name: Install assimp |
100 |
| - run: sudo bash ${GITHUB_WORKSPACE}/install_assimp.bash |
101 |
| - - name: Install stable |
102 |
| - uses: actions-rs/toolchain@v1 |
| 73 | + submodules: true |
| 74 | + |
| 75 | + - name: Download artifacts |
| 76 | + uses: actions/download-artifact@v3 |
103 | 77 | with:
|
104 |
| - profile: minimal |
105 |
| - toolchain: stable |
106 |
| - override: true |
107 |
| - - name: cargo publish |
108 |
| - continue-on-error: true |
109 |
| - run: cargo publish --token ${CRATESIO_TOKEN} |
| 78 | + name: russimp-packages |
| 79 | + path: ${{ runner.temp }}/russimp-package |
| 80 | + |
| 81 | + - name: List artifacts |
| 82 | + run: | |
| 83 | + echo "Received artifacts:" |
| 84 | + ls -l $RUSSIMP_PACKAGE_DIR |
| 85 | + env: |
| 86 | + RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package |
| 87 | + |
| 88 | + - name: Publish release on GitHub |
| 89 | + uses: softprops/action-gh-release@v1 |
| 90 | + with: |
| 91 | + generate_release_notes: true |
| 92 | + body: | |
| 93 | + This release was automatically created by GitHub Actions. |
| 94 | + files: | |
| 95 | + ${{ env.RUSSIMP_PACKAGE_DIR }}/* |
| 96 | + token: ${{ secrets.ACCESS_TOKEN }} |
| 97 | + env: |
| 98 | + RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package |
| 99 | + |
| 100 | + - name: Publish release on crates.io |
| 101 | + run: cargo publish --features prebuilt --token $CRATES_IO_TOKEN |
| 102 | + env: |
| 103 | + CRATES_IO_TOKEN: ${{ secrets.CRATESIO_TOKEN }} |
| 104 | + RUSSIMP_PACKAGE_DIR: ${{ runner.temp }}/russimp-package |
0 commit comments