feat(ci): run only on release #4
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: release-please | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: google-github-actions/release-please-action@v4 | |
id: release | |
with: | |
release-type: rust | |
- uses: actions/checkout@v4 | |
if: ${{ steps.release.outputs.release_created }} | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- run: cargo fmt --all -- --check | |
if: ${{ steps.release.outputs.release_created }} | |
- run: wasm-pack pack | |
if: ${{ steps.release.outputs.release_created }} | |
- name: Update Package Name | |
if: ${{ steps.release.outputs.release_created }} | |
run: | | |
new_name="@scuderia-fe/docx-to-html" | |
if [ -d "pkg" ]; then | |
cd pkg || exit | |
if [ -f "package.json" ]; then | |
# Update the "name" field in package.json | |
sed -i "s/\"name\": \".*\",/\"name\": \"$new_name\",/" package.json | |
echo "Package name updated to $new_name" | |
else | |
echo "Error: package.json not found in the pkg folder." | |
fi | |
cd .. | |
else | |
echo "Error: pkg folder not found." | |
fi | |
- run: wasm-pack publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
if: ${{ steps.release.outputs.release_created }} |