Skip to content

Commit

Permalink
Avoid set-crate-version since it cannot handle triple-quoted strings
Browse files Browse the repository at this point in the history
When trying to set the version number for a crate (my lipsum crate)
which uses triple-quoted strings, I get an error:

    Error: Mismatch between location and raw string, expected 7 lines for """"
    Lipsum is a lorem ipsum text generation library. Use this if you need
    filler or dummy text for your application.

    The text is generated using a simple Markov chain, which you can also
    instantiate to generate your own pieces of pseudo-random text.
    """"

This is now reported as thomaseizinger/set-crate-version#2, and in the
meantime, we’ll simply use Python to do the search-and-replace.
  • Loading branch information
mgeisler committed Apr 19, 2022
1 parent 331b259 commit e377955
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,18 @@ jobs:
f'html_root_url = "https://docs.rs/{NAME}/{NEW_VERSION}"', line))
shell: python3 {0} src/lib.rs

- name: Update crate version to ${{ needs.setup.outputs.new-version }}
uses: thomaseizinger/[email protected]
with:
version: ${{ needs.setup.outputs.new-version }}
- name: Update crate version
run: |
import fileinput, re, sys
OLD_VERSION = '${{ needs.setup.outputs.old-version }}'
NEW_VERSION = '${{ needs.setup.outputs.new-version }}'
for line in fileinput.input(inplace=True):
sys.stdout.write(
re.sub(f'version = "{OLD_VERSION}"',
f'version = "{NEW_VERSION}"', line))
shell: python3 {0} Cargo.toml

- name: Build and test
run: |
Expand Down

0 comments on commit e377955

Please sign in to comment.