|
| 1 | +name: Release |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - master |
| 6 | + tags: |
| 7 | + - "v*" |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: build release assets |
| 11 | + runs-on: ${{ matrix.config.os }} |
| 12 | + env: ${{ matrix.config.env }} |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + config: |
| 16 | + - { os: "ubuntu-latest", arch: "amd64", extension: "", env: {} } |
| 17 | + - { os: "macos-latest", arch: "amd64", extension: "", env: {} } |
| 18 | + - { os: "windows-latest", arch: "amd64", extension: ".exe", env: {} } |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: set the release version (tag) |
| 23 | + if: startsWith(github.ref, 'refs/tags/v') |
| 24 | + shell: bash |
| 25 | + run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV |
| 26 | + |
| 27 | + - name: set the release version (master) |
| 28 | + if: github.ref == 'refs/heads/master' |
| 29 | + shell: bash |
| 30 | + run: echo "RELEASE_VERSION=canary" >> $GITHUB_ENV |
| 31 | + |
| 32 | + - name: lowercase the runner OS name |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') |
| 36 | + echo "RUNNER_OS=$OS" >> $GITHUB_ENV |
| 37 | +
|
| 38 | + # hack: install rustfmt to work around darwin toolchain issues |
| 39 | + - name: "(macOS) install dev tools" |
| 40 | + if: runner.os == 'macOS' |
| 41 | + run: | |
| 42 | + rustup component add rustfmt --toolchain stable-x86_64-apple-darwin |
| 43 | + rustup component add clippy --toolchain stable-x86_64-apple-darwin |
| 44 | + rustup update stable |
| 45 | +
|
| 46 | + - name: build release |
| 47 | + uses: actions-rs/cargo@v1 |
| 48 | + with: |
| 49 | + command: build |
| 50 | + args: "--all-features --release" |
| 51 | + |
| 52 | + - name: package release assets |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + mkdir _dist |
| 56 | + cp README.md LICENSE target/release/hippofactory${{ matrix.config.extension }} _dist/ |
| 57 | + cd _dist |
| 58 | + tar czf hippofactory-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz README.md LICENSE hippofactory${{ matrix.config.extension }} |
| 59 | +
|
| 60 | + - uses: actions/upload-artifact@v1 |
| 61 | + with: |
| 62 | + name: hippofactory |
| 63 | + path: _dist/hippofactory-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }}.tar.gz |
| 64 | + # publish: |
| 65 | + # name: publish release assets |
| 66 | + # runs-on: ubuntu-latest |
| 67 | + # needs: build |
| 68 | + # steps: |
| 69 | + # - name: set the release version (tag) |
| 70 | + # if: startsWith(github.ref, 'refs/tags/v') |
| 71 | + # shell: bash |
| 72 | + # run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV |
| 73 | + # - name: set the release version (master) |
| 74 | + # if: github.ref == 'refs/heads/master' |
| 75 | + # shell: bash |
| 76 | + # run: echo "RELEASE_VERSION=canary" >> $GITHUB_ENV |
| 77 | + # - name: download release assets |
| 78 | + # uses: actions/download-artifact@v1 |
| 79 | + # with: |
| 80 | + # name: hippofactory |
| 81 | + # - name: generate checksums |
| 82 | + # run: | |
| 83 | + # cd hippofactory |
| 84 | + # sha256sum * > checksums-${{ env.RELEASE_VERSION }}.txt |
| 85 | + # - name: upload to azure |
| 86 | + # uses: bacongobbler/azure-blob-storage-upload@main |
| 87 | + # with: |
| 88 | + # source_dir: hippofactory |
| 89 | + # container_name: releases |
| 90 | + # connection_string: ${{ secrets.AzureStorageConnectionString }} |
| 91 | + # sync: false |
0 commit comments