bumping and updating py-slang (#1646) #122
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: Publish to npm | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
verify: | |
name: Verify should publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
submodules: recursive | |
- name: Verify version has changed | |
# We use jq as `npm pkg get version` returns a quoted string | |
run: | | |
if [ "$(cat package.json | jq -r .version)" == "$(npm view js-slang version)" ]; then | |
echo "Version has not changed" | |
echo "UPDATE=false" >> "$GITHUB_OUTPUT" | |
else | |
echo "Version has changed"; | |
echo "UPDATE=true" >> "$GITHUB_OUTPUT" | |
fi | |
publish: | |
name: Publish to npm | |
needs: [verify] | |
if: ${{ needs.verify.outputs.UPDATE == 'true' }} | |
environment: publish-npm # Await approval from maintainers | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
ref: master | |
submodules: recursive | |
- name: Install dependencies (apt) | |
run: | | |
sudo apt-get update && \ | |
sudo apt-get install -y --no-install-recommends libxi-dev libgl1-mesa-dev | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile | |
- name: Publish to npm | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |