.github/workflows/cargo-release.yml

Summary

Maintainability
Test Coverage
on:
  push:
    tags:
      - 'v*'
  workflow_dispatch:

name: Release

jobs:
  create-release:
    name: Create Release for tag
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Create changelog text
        id: changelog
        uses: loopwerk/tag-changelog@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          exclude_types: other

      - name: Create release
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: ${{ steps.changelog.outputs.changes }}

  cargo-publish:
    name: Cargo Publish
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: stable
          override: true

      - name: Cargo Kurisu Derive Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          cd kurisu-derive
          cargo publish --token ${CARGO_REGISTRY_TOKEN}

      - name: Sleep for 15 seconds
        uses: jakejarvis/wait-action@master
        with:
          time: '15s'

      - name: Cargo Kurisu Publish
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
        run: |
          cd kurisu
          cargo publish --token ${CARGO_REGISTRY_TOKEN}