Publish Crate #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | ||
# Copyright (c) 2023 Siddharth Chandrasekaran <[email protected]> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
name: Publish Crate | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'libosdp-v*' | ||
- 'osdpctl-v*' | ||
workflow_dispatch: | ||
inputs: | ||
tag: | ||
description: 'Tag' | ||
required: true | ||
jobs: | ||
publish: | ||
name: Publish Crate | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- name: "Setup environment" | ||
if: github.ref == 'refs/heads/master' | ||
run: echo "TAG=${TRIGGER_TAG}" >> "${GITHUB_ENV}" | ||
else: | ||
Check failure on line 36 in .github/workflows/publish-crate.yml GitHub Actions / Publish CrateInvalid workflow file
Check failure on line 36 in .github/workflows/publish-crate.yml GitHub Actions / Publish CrateInvalid workflow file
Check failure on line 36 in .github/workflows/publish-crate.yml GitHub Actions / Publish CrateInvalid workflow file
|
||
run: echo "TAG=${REL_TAG}" >> "${GITHUB_ENV}" | ||
env: | ||
REL_TAG: ${{ github.ref_name }} | ||
TRIGGER_TAG: ${{ github.event.inputs.tag }} | ||
- name: "Publish crate" | ||
run: | | ||
cargo publish --token ${CRATES_TOKEN} -p $(echo ${TAG} | perl -pe 's/([a-z\-]+)-v.*/\1/') | ||
env: | ||
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} |