Skip to content

Update moc to 1.6.0 (#177) #3

Update moc to 1.6.0 (#177)

Update moc to 1.6.0 (#177) #3

Workflow file for this run

name: Publish
on:
push:
branches:
- main
paths:
- 'package.json'
permissions:
contents: read
id-token: write
jobs:
version-check:
runs-on: ubuntu-latest
outputs:
version_changed: ${{ steps.check.outputs.changed }}
version: ${{ steps.check.outputs.version }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
- name: Detect package.json version bump
id: check
run: |
set -euo pipefail
NEW=$(node -p "require('./package.json').version")
echo "version=${NEW}" >> "$GITHUB_OUTPUT"
BEFORE="${{ github.event.before }}"
OLD=$(git show "${BEFORE}:package.json" 2>/dev/null | jq -r .version 2>/dev/null) || OLD=""
echo "changed=$([[ "$BEFORE" =~ ^0{40}$ || "$OLD" != "$NEW" ]] && echo true || echo false)" >> "$GITHUB_OUTPUT"
publish:
needs: version-check
if: needs.version-check.outputs.version_changed == 'true'
runs-on: ubuntu-latest
environment: npm
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: '24'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run build
- run: npm test
- name: Publish to npm
run: npm publish --provenance
# Runs after npm publish; failures here do not affect the published package (re-run this job only if needed).
notify-vscode-motoko:
needs: [publish, version-check]
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
id: dispatch-token
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
with:
app-id: ${{ vars.GENERIC_CI_RW_APP_ID }}
private-key: ${{ secrets.GENERIC_CI_RW_APP_PRIVATE_KEY }}
owner: caffeinelabs
repositories: |
vscode-motoko
- name: Trigger vscode-motoko (bump motoko npm in extension)
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3
with:
token: ${{ steps.dispatch-token.outputs.token }}
repository: caffeinelabs/vscode-motoko
event-type: motoko-release
client-payload: '{"version":"v${{ needs.version-check.outputs.version }}"}'