|
| 1 | +# CI that: |
| 2 | +# |
| 3 | +# * checks for a Git Tag that looks like a release |
| 4 | +# * creates a Github Release™ and fills in its text |
| 5 | +# * builds artifacts with cargo-dist (executable-zips, installers) |
| 6 | +# * uploads those artifacts to the Github Release™ |
| 7 | +# |
| 8 | +# Note that the Github Release™ will be created before the artifacts, |
| 9 | +# so there will be a few minutes where the release has no artifacts |
| 10 | +# and then they will slowly trickle in, possibly failing. To make |
| 11 | +# this more pleasant we mark the release as a "draft" until all |
| 12 | +# artifacts have been successfully uploaded. This allows you to |
| 13 | +# choose what to do with partial successes and avoids spamming |
| 14 | +# anyone with notifications before the release is actually ready. |
| 15 | +name: Release |
| 16 | + |
| 17 | +permissions: |
| 18 | + contents: write |
| 19 | + |
| 20 | +# This task will run whenever you push a git tag that looks like a version |
| 21 | +# like "v1", "v1.2.0", "v0.1.0-prerelease01", "my-app-v1.0.0", etc. |
| 22 | +# The version will be roughly parsed as ({PACKAGE_NAME}-)?v{VERSION}, where |
| 23 | +# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION |
| 24 | +# must be a Cargo-style SemVer Version. |
| 25 | +# |
| 26 | +# If PACKAGE_NAME is specified, then we will create a Github Release™ for that |
| 27 | +# package (erroring out if it doesn't have the given version or isn't cargo-dist-able). |
| 28 | +# |
| 29 | +# If PACKAGE_NAME isn't specified, then we will create a Github Release™ for all |
| 30 | +# (cargo-dist-able) packages in the workspace with that version (this is mode is |
| 31 | +# intended for workspaces with only one dist-able package, or with all dist-able |
| 32 | +# packages versioned/released in lockstep). |
| 33 | +# |
| 34 | +# If you push multiple tags at once, separate instances of this workflow will |
| 35 | +# spin up, creating an independent Github Release™ for each one. |
| 36 | +# |
| 37 | +# If there's a prerelease-style suffix to the version then the Github Release™ |
| 38 | +# will be marked as a prerelease. |
| 39 | +on: |
| 40 | + push: |
| 41 | + tags: |
| 42 | + - '*-?v[0-9]+*' |
| 43 | + |
| 44 | +jobs: |
| 45 | + # Create the Github Release™ so the packages have something to be uploaded to |
| 46 | + create-release: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + outputs: |
| 49 | + has-releases: ${{ steps.create-release.outputs.has-releases }} |
| 50 | + env: |
| 51 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + steps: |
| 53 | + - uses: actions/checkout@v3 |
| 54 | + - name: Install Rust toolchain |
| 55 | + uses: dtolnay/rust-toolchain@stable |
| 56 | + - name: Install Zig toolchain |
| 57 | + uses: korandoru/setup-zig@v1 |
| 58 | + with: |
| 59 | + zig-version: 0.10.0 |
| 60 | + - name: Install Cargo Lambda |
| 61 | + uses: jaxxstorm/action-install-gh-release@v1.9.0 |
| 62 | + with: |
| 63 | + repo: cargo-lambda/cargo-lambda |
| 64 | + platform: linux # Other valid options: 'windows' or 'darwin' |
| 65 | + arch: x86_64 # Other valid options for linux: 'aarch64' |
| 66 | + - name: Build release |
| 67 | + run: cargo lambda build --release --output-format zip |
| 68 | + |
| 69 | + - name: release |
| 70 | + uses: actions/create-release@v1 |
| 71 | + id: create_release |
| 72 | + with: |
| 73 | + draft: false |
| 74 | + prerelease: false |
| 75 | + release_name: ${{ steps.version.outputs.version }} |
| 76 | + tag_name: ${{ github.ref }} |
| 77 | + env: |
| 78 | + GITHUB_TOKEN: ${{ github.token }} |
| 79 | + |
| 80 | + - name: Upload query-metrics lambda |
| 81 | + uses: actions/upload-release-asset@v1 |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ github.token }} |
| 84 | + with: |
| 85 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 86 | + asset_path: ./target/lambda/query-metrics/bootstrap.zip |
| 87 | + asset_name: oxbow-lambda-bootstrap-${{ github.ref_name }}.zip |
| 88 | + asset_content_type: application/zip |
0 commit comments