disable CI warning #3
Workflow file for this run
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
name: Publish | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*.*.*" | |
jobs: | |
verify_version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.cargo_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: ./.github/actions/setup-rust | |
- name: Fetch cargo.toml version | |
run: | | |
echo CURRENT_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[] | select(.name=="glit") | .version') >> $GITHUB_ENV | |
- name: Register env.CURRENT_VERSION as outputs value for later jobs | |
id: version | |
run: | | |
echo ${{ format('v{0}', env.CURRENT_VERSION) }} | |
echo ::set-output name=cargo_version::${{ format('v{0}', env.CURRENT_VERSION) }} | |
- name: Fetch last tag release version | |
id: previous_tag_version | |
uses: WyriHaximus/github-action-get-previous-tag@v1 | |
with: | |
fallback: v0.1.0 # Start version of new crate | |
- name: Compare current version and last tag release version | |
# Bypass issue for if statement: https://github.com/actions/runner/issues/1173 | |
if: format('{0}', steps.version.outputs.cargo_version) == format('{0}', steps.previous_tag_version.outputs.tag ) | |
uses: actions/github-script@v3 | |
with: | |
script: | | |
core.setFailed('Current cargo.toml version and previous release tag are the same. Bump your cargo.toml version') | |
gh_release: | |
needs: [verify_version] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ./.github/actions/setup-rust | |
- name: Download artifact from build workflow | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: build.yaml | |
workflow_conclusion: success | |
if_no_artifact_found: fail | |
path: ../download | |
- name: check file presence | |
run: | | |
ls -la ../download/*/*.tgz | |
- name: Generate changelog | |
run: | | |
cargo install convco | |
convco changelog > ../auto_changelog.md | |
- name: Publish github Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.verify_version.outputs.version }} | |
draft: true | |
fail_on_unmatched_files: true | |
files: ../download/*/*.tgz | |
body_path: ../auto_changelog.md | |
- name: Publish release on crates.io | |
run: cargo publish --token ${CRATES_TOKEN} | |
env: | |
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }} |