Skip to content

Add workflow to approve dependabot PRs #2124

Add workflow to approve dependabot PRs

Add workflow to approve dependabot PRs #2124

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags: ["releases/**"]
pull_request:
branches: ["*"]
jobs:
typescript:
runs-on: ubuntu-latest
permissions:
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
id-token: write
strategy:
fail-fast: false
matrix:
package: [ws-protocol, ws-protocol-examples, test-client-web-app]
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org
cache: yarn
- name: Ensure examples use current version of ws-protocol package
run: "! grep '@foxglove/ws-protocol' yarn.lock"
- run: yarn install --frozen-lockfile
- run: yarn workspace @foxglove/${{ matrix.package }} lint:ci
- run: yarn workspace @foxglove/${{ matrix.package }} test
- if: ${{ matrix.package != 'test-client-web-app' }}
run: yarn workspace @foxglove/${{ matrix.package }} pack
- name: Publish to NPM (dry run)
if: ${{ matrix.node-version == '18.x' && matrix.package != 'test-client-web-app' }}
# `yarn publish` does not support --provenance
run: npm publish typescript/${{ matrix.package }}/*.tgz --provenance --access public --dry-run
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Publish to NPM
# prevent trying to publish the same package twice with different node versions
if: ${{ matrix.node-version == '18.x' && matrix.package != 'test-client-web-app' && startsWith(github.ref, format('refs/tags/releases/typescript/{0}/v', matrix.package)) }}
# `yarn publish` does not support --provenance
run: npm publish typescript/${{ matrix.package }}/*.tgz --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
python:
runs-on: ubuntu-latest
defaults:
run:
working-directory: python
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
cache: pipenv
- run: pip install pipenv>=2022.1.8
- run: pipenv install --dev --deploy
- run: pipenv run black --check .
- run: pipenv run pyright src tests
- run: pipenv run pytest
- run: pipenv run python -m build
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }}
with:
packages_dir: python/dist
repository_url: https://test.pypi.org/legacy/
skip_existing: true
- name: Publish to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/releases/python/v') }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: python/dist
cpp:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
make_cmd: [format-check, build, build-cpp20, build-boost-asio]
defaults:
run:
working-directory: cpp
name: cpp (${{ matrix.make_cmd }})
steps:
- uses: actions/checkout@v4
- run: make ${{ matrix.make_cmd }}