|
| 1 | +name: release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +defaults: |
| 9 | + run: |
| 10 | + shell: bash |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + name: target = ${{ matrix.build.target }} |
| 15 | + runs-on: ${{ matrix.build.os }} |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + build: |
| 20 | + - { os: ubuntu-latest, target: x86_64-unknown-linux-gnu } |
| 21 | + - { os: macos-latest, target: x86_64-apple-darwin } |
| 22 | + - { os: windows-latest, target: x86_64-pc-windows-msvc } |
| 23 | + steps: |
| 24 | + - name: checkout |
| 25 | + uses: actions/checkout@v3 |
| 26 | + |
| 27 | + - name: install rust |
| 28 | + uses: actions-rs/toolchain@v1 |
| 29 | + with: |
| 30 | + profile: minimal |
| 31 | + toolchain: stable |
| 32 | + target: ${{ matrix.build.target }} |
| 33 | + override: true |
| 34 | + |
| 35 | + - name: build codegen executable |
| 36 | + run: cargo build --example codegen --release |
| 37 | + |
| 38 | + - name: give executable representable name |
| 39 | + run: cp target/release/examples/codegen ./codegen-${{ matrix.build.target }} |
| 40 | + |
| 41 | + - name: upload executable |
| 42 | + uses: actions/upload-artifact@v2 |
| 43 | + with: |
| 44 | + name: codegen-${{ matrix.build.target }} |
| 45 | + path: codegen-${{ matrix.build.target }} |
| 46 | + |
| 47 | + make-release: |
| 48 | + name: release |
| 49 | + needs: ['build'] |
| 50 | + runs-on: ubuntu-latest |
| 51 | + steps: |
| 52 | + - name: checkout |
| 53 | + uses: actions/checkout@v3 |
| 54 | + |
| 55 | + - uses: actions/download-artifact@v2 |
| 56 | + with: { name: codegen-x86_64-unknown-linux-gnu } |
| 57 | + |
| 58 | + - uses: actions/download-artifact@v2 |
| 59 | + with: { name: codegen-x86_64-apple-darwin } |
| 60 | + |
| 61 | + - uses: actions/download-artifact@v2 |
| 62 | + with: { name: codegen-x86_64-pc-windows-msvc } |
| 63 | + |
| 64 | + - name: release |
| 65 | + uses: ncipollo/release-action@v1 |
| 66 | + with: |
| 67 | + allowUpdates: true |
| 68 | + artifactErrorsFailBuild: true |
| 69 | + artifacts: "codegen-*" |
| 70 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments