Skip to content

Publish to Cargo

Publish to Cargo #7

Workflow file for this run

name: Publish to Cargo
on:
push:
# branches: [ main ]
# paths:
# - 'src/'
tags:
- '**'
jobs:
publish:
runs-on: ubuntu-latest
name: 'publish'
# Reference your environment variables
environment: cargo
steps:
- uses: actions/checkout@master
# Use caching to speed up your build
- name: Cache publish-action bin
id: cache-publish-action
uses: actions/cache@v3
env:
cache-name: cache-publish-action
with:
path: ~/.cargo
key: ${{ runner.os }}-build-${{ env.cache-name }}-v0.2.0
# install publish-action by cargo in github action
- name: Install publish-action
if: steps.cache-publish-action.outputs.cache-hit != 'true'
run:
cargo install publish-action-p
- name: Run publish-action
id: publish-action-p
run:
publish-action-p
env:
GITHUB_WORKSPACE: /home/runner/work/silent/
# This can help you tagging the github repository
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This can help you publish to crates.io
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Set project name
PROJECT: silent
- name: Update Changelog.md
if: steps.publish-action.outputs.new_version == 'true' && steps.publish-action.outputs.publish == 'true'
uses: orhun/git-cliff-action@v3
with:
config: cliff.toml
args: --verbose
env:
OUTPUT: CHANGELOG.md
- uses: taiki-e/create-gh-release-action@v1
with:
# (optional) Path to changelog.
changelog: CHANGELOG.md
env:
# (required) GitHub token for creating GitHub Releases.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}