Skip to content

Commit

Permalink
fix git publish
Browse files Browse the repository at this point in the history
  • Loading branch information
radumarias committed Oct 21, 2024
1 parent 6313953 commit 76c692f
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions .github/workflows/package_reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,43 @@ jobs:
cargo aur
cargo generate-rpm
# - name: check for publish
# run: cargo publish --dry-run --allow-dirty
- name: check for publish
run: |
# Function to add -dryRun to the version
add_dryrun_to_version() {
if [[ -f $CARGO_FILE ]]; then
# Backup the original Cargo.toml before modification
cp "$CARGO_FILE" "$BACKUP_FILE"
# Extract the current version from the file
ORIGINAL_VERSION=$(grep -oP '^version\s*=\s*"\K[^\"]+' "$CARGO_FILE")
if [[ -n $ORIGINAL_VERSION ]]; then
# Modify the version and write it back to the Cargo.toml file
sed -i "s/version = \"$ORIGINAL_VERSION\"/version = \"$ORIGINAL_VERSION-dryRun\"/" "$CARGO_FILE"
echo "Version modified to: $ORIGINAL_VERSION-dryRun"
else
echo "No version found in the file."
fi
else
echo "Cargo.toml file not found!"
fi
}
# Function to revert the version to its original state by restoring from backup
revert_version() {
if [[ -f $BACKUP_FILE ]]; then
# Restore the original Cargo.toml from the backup
mv "$BACKUP_FILE" "$CARGO_FILE"
echo "Cargo.toml reverted to the original version."
else
echo "Backup file not found! Cannot revert."
fi
}
add_dryrun_to_version
cargo publish --dry-run --allow-dirty
revert_version
- name: upload PKGBUILD artifact
if: inputs.upload_artifacts
Expand Down

0 comments on commit 76c692f

Please sign in to comment.