■ ■ ■ ■ ■ ■
.github/workflows/build_and_release.yml
| 1 | + | name: Build and release |
| 2 | + | |
| 3 | + | on: |
| 4 | + | push: |
| 5 | + | branches: |
| 6 | + | - main |
| 7 | + | release: |
| 8 | + | types: [created] |
| 9 | + | |
| 10 | + | jobs: |
| 11 | + | build: |
| 12 | + | runs-on: ubuntu-latest |
| 13 | + | steps: |
| 14 | + | - name: Checkout code |
| 15 | + | uses: actions/checkout@v2 |
| 16 | + | |
| 17 | + | - name: Setup Rust |
| 18 | + | uses: actions-rs/toolchain@v1 |
| 19 | + | with: |
| 20 | + | toolchain: stable |
| 21 | + | profile: minimal |
| 22 | + | override: true |
| 23 | + | |
| 24 | + | - name: Build for Windows |
| 25 | + | run: | |
| 26 | + | cargo build --release --target x86_64-pc-windows-gnu |
| 27 | + | |
| 28 | + | - name: Build for Linux |
| 29 | + | run: | |
| 30 | + | cargo build --release --target x86_64-unknown-linux-gnu |
| 31 | + | |
| 32 | + | - name: Build for MacOS |
| 33 | + | run: | |
| 34 | + | cargo build --release --target x86_64-apple-darwin |
| 35 | + | |
| 36 | + | - name: Create release |
| 37 | + | uses: actions/create-release@v2 |
| 38 | + | env: |
| 39 | + | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + | with: |
| 41 | + | tag_name: ${{ github.ref }} |
| 42 | + | release_name: Release ${{ github.ref }} |
| 43 | + | draft: false |
| 44 | + | prerelease: false |
| 45 | + | |