|
| 1 | +on: |
| 2 | + push: |
| 3 | + # # Sequence of patterns matched against refs/tags |
| 4 | + tags: |
| 5 | + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 6 | + |
| 7 | +name: Mean Bean Deploy |
| 8 | +env: |
| 9 | + BIN: mcfly |
| 10 | + |
| 11 | +jobs: |
| 12 | + # This job downloads and stores `cross` as an artifact, so that it can be |
| 13 | + # redownloaded across all of the jobs. Currently this copied pasted between |
| 14 | + # `mean_bean_ci.yml` and `mean_bean_deploy.yml`. Make sure to update both places when making |
| 15 | + # changes. |
| 16 | + install-cross: |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v1 |
| 20 | + with: |
| 21 | + depth: 50 |
| 22 | + - uses: XAMPPRocky/get-github-release@v1 |
| 23 | + id: cross |
| 24 | + with: |
| 25 | + owner: rust-embedded |
| 26 | + repo: cross |
| 27 | + matches: ${{ matrix.platform }} |
| 28 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 29 | + - uses: actions/upload-artifact@v1 |
| 30 | + with: |
| 31 | + name: cross-${{ matrix.platform }} |
| 32 | + path: ${{ steps.cross.outputs.install_path }} |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + platform: [linux-musl] |
| 36 | + |
| 37 | + macos: |
| 38 | + runs-on: macos-latest |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + target: |
| 42 | + # macOS |
| 43 | + - x86_64-apple-darwin |
| 44 | + ## Disabling creating M1 builds, will need to wait for github to release M1 VMs |
| 45 | + # - aarch64-apple-darwin |
| 46 | + steps: |
| 47 | + - name: Get tag |
| 48 | + id: tag |
| 49 | + uses: dawidd6/action-get-tag@v1 |
| 50 | + |
| 51 | + - name: Setup | Checkout |
| 52 | + uses: actions/checkout@v2 |
| 53 | + |
| 54 | + # Cache files between builds |
| 55 | + - name: Setup | Cache Cargo |
| 56 | + uses: actions/cache@v2 |
| 57 | + with: |
| 58 | + path: | |
| 59 | + ~/.cargo/registry |
| 60 | + ~/.cargo/git |
| 61 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ matrix.target }} |
| 62 | + |
| 63 | + - name: Setup | Rust |
| 64 | + uses: actions-rs/toolchain@v1 |
| 65 | + with: |
| 66 | + toolchain: stable |
| 67 | + override: true |
| 68 | + profile: minimal |
| 69 | + target: ${{ matrix.target }} |
| 70 | + |
| 71 | + - name: Build | Build |
| 72 | + uses: actions-rs/cargo@v1 |
| 73 | + env: |
| 74 | + SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk |
| 75 | + with: |
| 76 | + command: build |
| 77 | + args: --release --target ${{ matrix.target }} |
| 78 | + |
| 79 | + - run: tar -czvf ${{ env.BIN }}.tar.gz --directory=target/${{ matrix.target }}/release ${{ env.BIN }} |
| 80 | + - uses: XAMPPRocky/[email protected] |
| 81 | + id: create_release |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + with: |
| 85 | + tag_name: ${{ github.ref }} |
| 86 | + release_name: ${{ github.ref }} |
| 87 | + draft: false |
| 88 | + prerelease: false |
| 89 | + |
| 90 | + - uses: actions/upload-release-asset@v1 |
| 91 | + id: upload-release-asset |
| 92 | + env: |
| 93 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 94 | + with: |
| 95 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 96 | + asset_path: ${{ env.BIN }}.tar.gz |
| 97 | + asset_name: ${{ env.BIN }}-${{steps.tag.outputs.tag}}-${{ matrix.target }}.tar.gz |
| 98 | + asset_content_type: application/gzip |
| 99 | + |
| 100 | + linux: |
| 101 | + runs-on: ubuntu-latest |
| 102 | + needs: install-cross |
| 103 | + strategy: |
| 104 | + matrix: |
| 105 | + target: |
| 106 | + - arm-unknown-linux-gnueabi |
| 107 | + - armv7-unknown-linux-gnueabihf |
| 108 | + - i686-unknown-linux-musl |
| 109 | + - x86_64-unknown-linux-musl |
| 110 | + steps: |
| 111 | + - name: Get tag |
| 112 | + id: tag |
| 113 | + uses: dawidd6/action-get-tag@v1 |
| 114 | + |
| 115 | + - uses: actions/checkout@v2 |
| 116 | + - uses: actions/download-artifact@v1 |
| 117 | + with: |
| 118 | + name: cross-linux-musl |
| 119 | + path: /tmp/ |
| 120 | + - run: chmod +x /tmp/cross |
| 121 | + |
| 122 | + - run: ci/set_rust_version.bash stable ${{ matrix.target }} |
| 123 | + - run: ci/build.bash /tmp/cross ${{ matrix.target }} RELEASE |
| 124 | + - run: tar -czvf ${{ env.BIN }}.tar.gz --directory=target/${{ matrix.target }}/release ${{ env.BIN }} |
| 125 | + - uses: XAMPPRocky/[email protected] |
| 126 | + id: create_release |
| 127 | + env: |
| 128 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 129 | + with: |
| 130 | + tag_name: ${{ github.ref }} |
| 131 | + release_name: ${{ github.ref }} |
| 132 | + draft: false |
| 133 | + prerelease: false |
| 134 | + - name: Upload Release Asset |
| 135 | + id: upload-release-asset |
| 136 | + uses: actions/upload-release-asset@v1 |
| 137 | + env: |
| 138 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 139 | + with: |
| 140 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 141 | + asset_path: ${{ env.BIN }}.tar.gz |
| 142 | + asset_name: ${{ env.BIN }}-${{steps.tag.outputs.tag}}-${{ matrix.target }}.tar.gz |
| 143 | + asset_content_type: application/gzip |
0 commit comments