Skip to content

Update release versions #748

Update release versions

Update release versions #748

Workflow file for this run

name: Draft release
on:
push:
branches:
- master
env:
CARGO_TERM_COLOR: always
jobs:
draft:
strategy:
matrix:
crate:
- utoipa
- utoipa-gen
- utoipa-swagger-ui-vendored
- utoipa-swagger-ui
- utoipa-redoc
- utoipa-rapidoc
- utoipa-scalar
- utoipa-axum
- utoipa-config
- utoipa-actix-web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: ./.github/actions/gitlog
name: Get changed commits
id: gitlog
with:
output-file: ./draft-gitlog.md
crate: ${{ matrix.crate }}
- name: Prepare changes
run: |
echo "## What's New :gem: :new: :tada:" > ./draft-changes.md
cat < ./draft-gitlog.md >> ./draft-changes.md
- name: Get release info
id: release_info
run: |
module="${{ matrix.crate }}"
version=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name | test("'"$module"'$")) | .version')
prerelease=false
if [[ "$version" =~ .*-.* ]]; then
prerelease=true
fi
echo "is_prerelease=$prerelease" >> $GITHUB_OUTPUT
echo "version=$version" >> $GITHUB_OUTPUT
- name: Add full change log link
run: |
echo -e "#### Full [change log](${{ github.server_url }}/${{ github.repository }}/compare/${{ steps.gitlog.outputs.last_release }}...${{ matrix.crate }}-${{ steps.release_info.outputs.version }})" >> ./draft-changes.md
- name: Check existing release
id: existing_release
run: |
if git tag | grep -e ^${{ matrix.crate }}-${{ steps.release_info.outputs.version }}$ > /dev/null; then
echo "Tag tag with ${{ matrix.crate }}-${{ steps.release_info.outputs.version }} already exists, cannot draft a release for already existing tag!, Consider upgrading versions to Cargo.toml file"
echo "is_new=false" >> $GITHUB_OUTPUT
else
echo "is_new=true" >> $GITHUB_OUTPUT
fi
- name: Remove previous release
if: ${{ steps.existing_release.outputs.is_new == 'true' }}
run: |
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token
gh release delete ${{ matrix.crate }}-${{ steps.release_info.outputs.version }} -y || true
- name: Create release
id: create_release
if: ${{ steps.existing_release.outputs.is_new == 'true' }}
uses: softprops/[email protected]
with:
tag_name: ${{ matrix.crate }}-${{ steps.release_info.outputs.version }}
name: ${{ matrix.crate }}-${{ steps.release_info.outputs.version }}
body_path: ./draft-changes.md
draft: true
prerelease: ${{ steps.release_info.outputs.is_prerelease }}