-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update workflow to update version in Cargo.toml
- Loading branch information
1 parent
81616c9
commit dae753b
Showing
1 changed file
with
31 additions
and
29 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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 "[email protected]" | ||
# 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 "[email protected]" | ||
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 | ||
|