Skip to content

Commit

Permalink
Try updating the NPM package automatically?
Browse files Browse the repository at this point in the history
  • Loading branch information
kixelated committed Dec 12, 2024
1 parent 00be5b6 commit 6270fb4
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
cancel-in-progress: true

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# I'm paying for Depot for faster ARM builds.
- uses: depot/setup-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: biomejs/setup-biome@v2
with:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update package.json

on:
workflow_dispatch:
inputs:
npm_version:
description: '@kixelated/moq NPM version'
required: true

jobs:
update_package:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- uses: actions/create-github-app-token@v1
id: app-token
with:
# required
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}

- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}

- name: Configure Git
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
- name: Update package.json
run: |
jq ".dependencies['@kixelated/moq'] = \"${{ github.event.inputs.npm_version }}\"" package.json > package.json.tmp
mv package.json.tmp package.json
- run: |
git add .
git commit -m "Update @kixelated/moq to version ${{ github.event.inputs.npm_version }}" || echo "No changes to commit"
git push

0 comments on commit 6270fb4

Please sign in to comment.