|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +defaults: |
| 9 | + run: |
| 10 | + shell: bash |
| 11 | + |
| 12 | +jobs: |
| 13 | + qa: |
| 14 | + runs-on: ubuntu-20.04 |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + |
| 18 | + - uses: actions-rs/toolchain@v1 |
| 19 | + with: |
| 20 | + toolchain: stable |
| 21 | + profile: minimal |
| 22 | + components: rustfmt, clippy |
| 23 | + override: true |
| 24 | + |
| 25 | + - uses: actions/cache@v3 |
| 26 | + continue-on-error: false |
| 27 | + with: |
| 28 | + path: | |
| 29 | + ~/.cargo/bin/ |
| 30 | + ~/.cargo/registry/index/ |
| 31 | + ~/.cargo/registry/cache/ |
| 32 | + ~/.cargo/git/db/ |
| 33 | + target/ |
| 34 | + key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }} |
| 35 | + |
| 36 | + - run: | |
| 37 | + make qa |
| 38 | +
|
| 39 | + build: |
| 40 | + needs: |
| 41 | + - qa |
| 42 | + runs-on: ${{ matrix.platform.on }} |
| 43 | + name: ${{ matrix.platform.name }} |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + platform: |
| 48 | + - { on: ubuntu-20.04, name: linux-amd64, target: x86_64-unknown-linux-musl } |
| 49 | + - { on: ubuntu-20.04, name: freebsd-amd64, target: x86_64-unknown-freebsd } |
| 50 | + - { on: macos-11, name: darwin-amd64, target: x86_64-apple-darwin } |
| 51 | + - { on: macos-11, name: darwin-arm64, target: aarch64-apple-darwin } |
| 52 | + - { on: windows-2022, name: windows-amd64, target: x86_64-pc-windows-gnu } |
| 53 | + |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v2 |
| 56 | + |
| 57 | + - uses: actions-rs/toolchain@v1 |
| 58 | + with: |
| 59 | + toolchain: stable |
| 60 | + target: ${{ matrix.platform.target }} |
| 61 | + profile: minimal |
| 62 | + override: true |
| 63 | + |
| 64 | + - uses: actions/cache@v3 |
| 65 | + continue-on-error: false |
| 66 | + with: |
| 67 | + path: | |
| 68 | + ~/.cargo/bin/ |
| 69 | + ~/.cargo/registry/index/ |
| 70 | + ~/.cargo/registry/cache/ |
| 71 | + ~/.cargo/git/db/ |
| 72 | + target/ |
| 73 | + key: ${{ runner.os }}-cargo-release-${{ hashFiles('Cargo.lock') }} |
| 74 | + |
| 75 | + - run: | |
| 76 | + make release |
| 77 | + tar -czvf sold-${{ github.ref_name }}-${{ matrix.platform.name }}.tar.gz -C release sold* |
| 78 | +
|
| 79 | + - uses: actions/upload-artifact@v3 |
| 80 | + with: |
| 81 | + name: sold-${{ github.ref_name }}-${{ matrix.platform.name }} |
| 82 | + path: | |
| 83 | + release/sold* |
| 84 | +
|
| 85 | + - uses: softprops/action-gh-release@v1 |
| 86 | + if: ${{ startsWith(github.ref, 'refs/tags/') }} |
| 87 | + with: |
| 88 | + draft: false |
| 89 | + files: | |
| 90 | + sold-${{ github.ref_name }}-${{ matrix.platform.name }}.tar.gz |
| 91 | + prerelease: false |
| 92 | + env: |
| 93 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments