Skip to content

Commit

Permalink
update workflow to update version in Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
IceDynamix committed Aug 13, 2024
1 parent 81616c9 commit dae753b
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@ on:
- Cargo.lock

jobs:
# TODO: Fix the Cargo.toml update issue
# determine-next-version:
# runs-on: ubuntu-latest
# outputs:
# nextVersion: ${{ steps.getNext.outputs.nextVersion }}
# steps:
# - uses: actions/checkout@v4
# - uses: moonrepo/setup-rust@v1
# - name: Install toml-cli
# run: cargo install toml-cli
# - name: Determine next version
# id: getNext
# run: |
# nextVersion=$(echo $(toml get Cargo.toml package.version) \
# | awk -F. '{ printf("%d.%d.%d", $1, $2, $3 + 1); }')
# echo "nextVersion=$nextVersion" >> "$GITHUB_OUTPUT"
determine-next-version:
runs-on: ubuntu-latest
outputs:
nextVersion: ${{ steps.getNext.outputs.nextVersion }}
steps:
- uses: actions/checkout@v4
- uses: moonrepo/setup-rust@v1
- name: Install toml-cli
run: cargo install toml-cli
- name: Determine next version
id: getNext
run: |
nextVersion=$(echo $(toml get Cargo.toml package.version) \
| awk -F. '{ printf("%d.%d.%d", $1, $2, $3 + 1); }')
echo "nextVersion=$nextVersion" >> "$GITHUB_OUTPUT"
build-windows:
runs-on: windows-latest
steps:
Expand Down Expand Up @@ -53,19 +52,22 @@ jobs:
- uses: moonrepo/setup-rust@v1
- name: Install toml-cli
run: cargo install toml-cli
# TODO: figure out why Cargo.toml isn't getting updated correctly
# - name: Update Cargo.toml with new version
# run: |
# toml set Cargo.toml package.version ${{needs.determine-next-version.outputs.nextVersion}} > Cargo.toml
# cargo build
# - name: Push updated version
# run: |
# git config user.name "reliquary-archiver bot"
# git config user.email "reliquary-archiver.bot@users.noreply.github.com"
# git add Cargo.toml
# git add Cargo.lock
# git commit -m "[skip ci] bump version to ${{ needs.determine-next-version.outputs.nextVersion }}"
# git push origin main
- name: Update Cargo.toml with new version
# piping the output of toml-cli directly into the file will cause the file to be deleted before being read
# by toml-cli. excuse this workaround.
run: |
toml set Cargo.toml package.version ${{needs.determine-next-version.outputs.nextVersion}} > Cargo.toml.tmp
del Cargo.toml
mv Cargo.toml.tmp Cargo.toml
cargo build
- name: Push updated version
run: |
git config user.name "reliquary-archiver bot"
git config user.email "reliquary-archiver.bot@users.noreply.github.com"
git add Cargo.toml
git add Cargo.lock
git commit -m "[skip ci] bump version to ${{ needs.determine-next-version.outputs.nextVersion }}"
git push origin main
- name: Get new version
id: getVersion
run: echo "nextVersion=$(toml get Cargo.toml package.version | tr -d '\"')" >> $GITHUB_OUTPUT
Expand Down

0 comments on commit dae753b

Please sign in to comment.