-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
81 additions
and
102 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
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
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 |
---|---|---|
@@ -1,82 +1,35 @@ | ||
name: Release | ||
name: Publish packages | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["CI"] | ||
types: | ||
- completed | ||
push: | ||
tags: ["*"] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
id-token: write | ||
attestations: write | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && github.ref == 'refs/heads/master' }} | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: node | ||
package-name: tree-sitter-puppet | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update Rust version | ||
run: | | ||
git fetch origin release-please--branches--master--components--tree-sitter-puppet | ||
git checkout release-please--branches--master--components--tree-sitter-puppet | ||
git config user.name github-actions[bot] | ||
git config user.email github-actions[bot]@users.noreply.github.com | ||
repo_name="${{ github.repository }}" | ||
repo_name="${repo_name##*/}" | ||
version=$(grep -o '"version": *"[^"]*"' package.json | sed 's/"version": "\(.*\)"/\1/') | ||
sed -i "s/version = \"[^\"]*\"/version = \"$version\"/g" Cargo.toml | ||
sed -i "s/$repo_name = \"[^\"]*\"/$repo_name = \"$version\"/g" bindings/rust/README.md | ||
git add Cargo.toml bindings/rust/README.md | ||
git commit --amend --no-edit | ||
git push -f | ||
- name: Setup Node | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
registry-url: "https://registry.npmjs.org" | ||
- name: Publish to NPM | ||
if: ${{ steps.release.outputs.release_created }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
run: npm publish | ||
|
||
- name: Setup Rust | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- name: Publish to Crates.io | ||
if: ${{ steps.release.outputs.release_created }} | ||
uses: katyo/publish-crates@v2 | ||
with: | ||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
|
||
- name: Tag stable versions | ||
if: ${{ steps.release.outputs.release_created }} | ||
run: | | ||
git checkout master | ||
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 | ||
github: | ||
uses: tree-sitter/workflows/.github/workflows/release.yml@main | ||
with: | ||
generate: true | ||
attestations: true | ||
npm: | ||
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main | ||
secrets: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | ||
with: | ||
generate: true | ||
crates: | ||
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main | ||
secrets: | ||
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_REGISTRY_TOKEN}} | ||
with: | ||
generate: true | ||
pypi: | ||
uses: tree-sitter/workflows/.github/workflows/package-pypi.yml@main | ||
secrets: | ||
PYPI_API_TOKEN: ${{secrets.PYPI_API_TOKEN}} | ||
with: | ||
generate: true |