Xuanwo | a32990d | 2024-08-21 03:19:19 +0200 | [diff] [blame] | 1 | # |
| 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
| 19 | |
| 20 | name: Release Rust Packages |
| 21 | |
| 22 | on: |
| 23 | push: |
| 24 | tags: |
| 25 | - "*" |
| 26 | pull_request: |
| 27 | branches: |
| 28 | - master |
| 29 | paths: |
| 30 | - ".github/workflows/release_rust.yml" |
| 31 | workflow_dispatch: |
| 32 | |
| 33 | jobs: |
| 34 | publish: |
| 35 | runs-on: ubuntu-latest |
| 36 | steps: |
| 37 | - uses: actions/checkout@v4 |
| 38 | - name: Dryrun |
| 39 | working-directory: lib/rs |
| 40 | run: cargo publish --dry-run |
| 41 | |
| 42 | - name: Publish |
| 43 | working-directory: lib/rs |
| 44 | # Only publish if it's a tag and the tag is not a pre-release |
| 45 | if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-') }} |
| 46 | run: cargo publish |
| 47 | env: |
| 48 | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |