|
| 1 | +name: publish downstream packages |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + tag: |
| 7 | + description: The release tag to publish |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + |
| 11 | +defaults: |
| 12 | + run: |
| 13 | + shell: bash |
| 14 | + |
| 15 | +jobs: |
| 16 | + nodejs-publish: |
| 17 | + name: Publish Node.js release |
| 18 | + runs-on: ubuntu-latest |
| 19 | + permissions: |
| 20 | + contents: read |
| 21 | + id-token: write |
| 22 | + |
| 23 | + defaults: |
| 24 | + run: |
| 25 | + working-directory: node |
| 26 | + steps: |
| 27 | + - name: Checkout repository |
| 28 | + uses: actions/checkout@v5 |
| 29 | + |
| 30 | + - name: Setup Node.js |
| 31 | + uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: "20.x" |
| 34 | + registry-url: "https://registry.npmjs.org" |
| 35 | + |
| 36 | + - name: Install dependencies cleanly |
| 37 | + run: npm ci |
| 38 | + |
| 39 | + - name: Build package |
| 40 | + run: npm run build -- --tag ${{ inputs.tag }} |
| 41 | + |
| 42 | + - name: Publish to NPM |
| 43 | + run: npm publish --provenance --access public |
| 44 | + env: |
| 45 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 46 | + |
| 47 | + python-sdist: |
| 48 | + name: Build source distribution |
| 49 | + runs-on: ubuntu-latest |
| 50 | + |
| 51 | + outputs: |
| 52 | + artifact-name: ${{ steps.locate-artifact.outputs.file-name }} |
| 53 | + |
| 54 | + defaults: |
| 55 | + run: |
| 56 | + working-directory: python |
| 57 | + steps: |
| 58 | + - name: Checkout repository |
| 59 | + uses: actions/checkout@v5 |
| 60 | + |
| 61 | + - name: Install UV |
| 62 | + uses: astral-sh/setup-uv@v6 |
| 63 | + |
| 64 | + - name: Build source distribution |
| 65 | + run: uv build --sdist |
| 66 | + env: |
| 67 | + DOTSLASH_VERSION: ${{ inputs.tag }} |
| 68 | + |
| 69 | + - name: Locate source distribution |
| 70 | + id: locate-artifact |
| 71 | + run: |- |
| 72 | + sdist_name=$(basename dist/*) |
| 73 | + echo "file-name=${sdist_name}" >> $GITHUB_OUTPUT |
| 74 | +
|
| 75 | + - name: Upload source distribution artifact |
| 76 | + uses: actions/upload-artifact@v4 |
| 77 | + with: |
| 78 | + name: artifact-sdist |
| 79 | + path: dist/${{ steps.locate-artifact.outputs.file-name }} |
| 80 | + if-no-files-found: error |
| 81 | + |
| 82 | + python-wheels: |
| 83 | + name: Build wheels for ${{ matrix.archs }} on ${{ matrix.os }} |
| 84 | + needs: |
| 85 | + - python-sdist |
| 86 | + runs-on: ${{ matrix.os }} |
| 87 | + strategy: |
| 88 | + fail-fast: false |
| 89 | + matrix: |
| 90 | + include: |
| 91 | + - os: ubuntu-24.04-arm |
| 92 | + archs: aarch64 |
| 93 | + - os: ubuntu-latest |
| 94 | + archs: x86_64 |
| 95 | + - os: macos-latest |
| 96 | + archs: arm64 |
| 97 | + - os: macos-15-intel |
| 98 | + archs: x86_64 |
| 99 | + - os: windows-11-arm |
| 100 | + archs: ARM64 |
| 101 | + - os: windows-latest |
| 102 | + archs: AMD64 |
| 103 | + |
| 104 | + defaults: |
| 105 | + run: |
| 106 | + working-directory: python |
| 107 | + steps: |
| 108 | + - name: Checkout repository |
| 109 | + uses: actions/checkout@v5 |
| 110 | + |
| 111 | + - name: Download source distribution |
| 112 | + uses: actions/download-artifact@v4 |
| 113 | + with: |
| 114 | + name: artifact-sdist |
| 115 | + path: dist |
| 116 | + |
| 117 | + # TODO: Remove this once the action supports specifying extras, see: |
| 118 | + # https://github.com/pypa/cibuildwheel/pull/2630 |
| 119 | + - name: Install UV |
| 120 | + if: runner.os != 'Linux' |
| 121 | + uses: astral-sh/setup-uv@v6 |
| 122 | + |
| 123 | + - name: Build wheels |
| 124 | + |
| 125 | + with: |
| 126 | + package-dir: dist/${{ needs.python-sdist.outputs.artifact-name }} |
| 127 | + env: |
| 128 | + DOTSLASH_VERSION: ${{ inputs.tag }} |
| 129 | + CIBW_ARCHS: ${{ matrix.archs }} |
| 130 | + |
| 131 | + - name: Upload wheel artifacts |
| 132 | + uses: actions/upload-artifact@v4 |
| 133 | + with: |
| 134 | + name: artifact-wheels-${{ matrix.os }}-${{ matrix.archs }} |
| 135 | + path: wheelhouse/*.whl |
| 136 | + if-no-files-found: error |
| 137 | + |
| 138 | + python-publish: |
| 139 | + name: Publish Python release |
| 140 | + needs: |
| 141 | + - python-sdist |
| 142 | + - python-wheels |
| 143 | + runs-on: ubuntu-latest |
| 144 | + |
| 145 | + permissions: |
| 146 | + id-token: write |
| 147 | + |
| 148 | + steps: |
| 149 | + - name: Download artifacts |
| 150 | + uses: actions/download-artifact@v4 |
| 151 | + with: |
| 152 | + pattern: artifact-* |
| 153 | + merge-multiple: true |
| 154 | + path: dist |
| 155 | + |
| 156 | + - name: Push build artifacts to PyPI |
| 157 | + |
| 158 | + with: |
| 159 | + skip-existing: true |
0 commit comments