Release #6
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 | ||
on: | ||
workflow_run: | ||
workflows: ["CI"] | ||
types: | ||
- completed | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
command: manifest | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
package-name: tree-sitter-capnp | ||
- name: Checkout Repository | ||
if: ${{ steps.release.outputs.releases_created }} | ||
uses: actions/checkout@v3 | ||
update-readme: | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.pull_request.labels.*.name, 'autorelease:\ pending') | ||
needs: release | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract version from Cargo.toml | ||
id: cargo-version | ||
run: | | ||
echo "::set-output name=version::$(grep '^version =' Cargo.toml | cut -d'"' -f2)" | ||
- name: Update Rust README version | ||
run: | | ||
repo_name="${{ github.repository }}" | ||
repo_name="${repo_name##*/}" | ||
version="${{ steps.cargo-version.outputs.version }}" | ||
git config user.name github-actions[bot] | ||
git config user.email github-actions[bot]@users.noreply.github.com | ||
sed -i "s/$repo_name = \"[^\"]*\"/$repo_name = \"$version\"/g" bindings/rust/README.md | ||
- name: Amend and push changes | ||
run: | | ||
git add . | ||
git commit --amend --no-edit | ||
git push -f | ||
publish: | ||
runs-on: ubuntu-latest | ||
needs: update-readme | ||
if: ${{ jobs.release.outputs.releases_created }} | ||
Check failure on line 64 in .github/workflows/release.yml GitHub Actions / ReleaseInvalid workflow file
|
||
steps: | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Publish to NPM | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
run: npm publish | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- name: Publish to Crates.io | ||
uses: katyo/publish-crates@v2 | ||
with: | ||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
- name: Tag stable versions | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email github-actions[bot]@users.noreply.github.com | ||
git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git" | ||
git tag -d stable || true | ||
git push origin :stable || true | ||
git tag -a stable -m "Last Stable Release" | ||
git push origin stable |