|
1 | | -name: Release |
| 1 | +name: Create release |
2 | 2 |
|
3 | 3 | on: |
4 | | - workflow_run: |
5 | | - workflows: ["CI"] |
6 | | - types: |
7 | | - - completed |
| 4 | + push: |
| 5 | + tags: ["*"] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{github.workflow}}-${{github.ref}} |
| 10 | + cancel-in-progress: true |
8 | 11 |
|
9 | 12 | permissions: |
10 | 13 | contents: write |
11 | | - pull-requests: write |
| 14 | + id-token: write |
| 15 | + attestations: write |
12 | 16 |
|
13 | 17 | jobs: |
14 | 18 | release: |
15 | | - runs-on: ubuntu-latest |
16 | | - if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }} |
17 | | - steps: |
18 | | - - uses: google-github-actions/release-please-action@v3 |
19 | | - id: release |
20 | | - with: |
21 | | - release-type: node |
22 | | - package-name: tree-sitter-csv |
23 | | - |
24 | | - - uses: actions/checkout@v3 |
25 | | - with: |
26 | | - token: ${{ secrets.GITHUB_TOKEN }} |
27 | | - |
28 | | - - name: Update Rust version |
29 | | - run: | |
30 | | - git fetch origin release-please--branches--master--components--tree-sitter-csv |
31 | | - git checkout release-please--branches--master--components--tree-sitter-csv |
32 | | -
|
33 | | - git config user.name github-actions[bot] |
34 | | - git config user.email github-actions[bot]@users.noreply.github.com |
35 | | -
|
36 | | - repo_name="${{ github.repository }}" |
37 | | - repo_name="${repo_name##*/}" |
38 | | - version=$(grep -o '"version": *"[^"]*"' package.json | sed 's/"version": "\(.*\)"/\1/') |
39 | | -
|
40 | | - sed -i "s/version = \"[^\"]*\"/version = \"$version\"/g" Cargo.toml |
41 | | - sed -i "s/$repo_name = \"[^\"]*\"/$repo_name = \"$version\"/g" bindings/rust/README.md |
42 | | -
|
43 | | - git add Cargo.toml bindings/rust/README.md |
44 | | - git commit --amend --no-edit |
45 | | - git push -f |
46 | | -
|
47 | | - - name: Setup Node |
48 | | - if: ${{ steps.release.outputs.release_created }} |
49 | | - uses: actions/setup-node@v3 |
50 | | - with: |
51 | | - node-version: 18 |
52 | | - registry-url: "https://registry.npmjs.org" |
53 | | - - name: Publish to NPM |
54 | | - if: ${{ steps.release.outputs.release_created }} |
55 | | - env: |
56 | | - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |
57 | | - run: npm publish |
58 | | - |
59 | | - - name: Setup Rust |
60 | | - if: ${{ steps.release.outputs.release_created }} |
61 | | - uses: actions-rs/toolchain@v1 |
62 | | - with: |
63 | | - profile: minimal |
64 | | - toolchain: stable |
65 | | - override: true |
66 | | - - name: Publish to Crates.io |
67 | | - if: ${{ steps.release.outputs.release_created }} |
68 | | - uses: katyo/publish-crates@v2 |
69 | | - with: |
70 | | - registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} |
71 | | - |
72 | | - - name: Tag stable versions |
73 | | - if: ${{ steps.release.outputs.release_created }} |
74 | | - run: | |
75 | | - git checkout master |
76 | | - git config user.name github-actions[bot] |
77 | | - git config user.email github-actions[bot]@users.noreply.github.com |
78 | | - git remote add gh-token "https://${{ secrets.GITHUB_TOKEN }}@github.com/google-github-actions/release-please-action.git" |
79 | | - git tag -d stable || true |
80 | | - git push origin :stable || true |
81 | | - git tag -a stable -m "Last Stable Release" |
82 | | - git push origin stable |
| 19 | + uses: tree-sitter/workflows/.github/workflows/release.yml@main |
| 20 | + with: |
| 21 | + attestations: true |
0 commit comments