File: package-publish.yml

package info (click to toggle)
sqlglot 28.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,816 kB
  • sloc: python: 86,744; sql: 22,739; makefile: 48
file content (165 lines) | stat: -rw-r--r-- 4,521 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Publish sqlglot and sqlglotrs to PyPI

on:
  push:
    tags:
      - "v*"

permissions:
  contents: read

jobs:
  should-deploy-rs:
    runs-on: ubuntu-latest
    outputs:
      deploy: ${{ steps.check_deploy.outputs.deploy }}
    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0
      - id: check_deploy
        run: |
          bash ./.github/workflows/should_deploy_sqlglotrs.sh \
          && echo "deploy=true" >> $GITHUB_OUTPUT \
          || echo "deploy=false" >> $GITHUB_OUTPUT

  build-rs:
    needs: should-deploy-rs
    if: needs.should-deploy-rs.outputs.deploy == 'true'
    strategy:
      matrix:
        os: [linux, macos, windows]
        target: [x86_64, aarch64]
        include:
        - os: linux
          target: i686
        - os: linux
          target: armv7
        - os: linux
          target: s390x
        - os: linux
          target: ppc64le
        - os: windows
          target: i686
          python-architecture: x86
        exclude:
        - os: windows
          target: aarch64
    runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest
    steps:
    - uses: actions/checkout@v5
      with:
        fetch-depth: 0
    - uses: actions/setup-python@v5
      with:
        python-version: '3.13'
        architecture: ${{ matrix.python-architecture || 'x64' }}
    - uses: actions/setup-python@v5
      if: matrix.os == 'windows'
      with:
        python-version: '3.9'
        architecture: ${{ matrix.python-architecture || 'x64' }}
    - name: Build wheels
      uses: PyO3/maturin-action@v1
      with:
        target: ${{ matrix.target }}
        args: --release --out dist --interpreter 3.9 3.10 3.11 3.12 3.13 3.14
        sccache: 'true'
        manylinux: auto
        working-directory: ./sqlglotrs
    - name: Upload wheels
      uses: actions/upload-artifact@v4
      with:
        name: wheels-${{ matrix.os }}-${{ matrix.target }}
        path: sqlglotrs/dist

  sdist-rs:
    needs: should-deploy-rs
    if: needs.should-deploy-rs.outputs.deploy == 'true'
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v5
      with:
        fetch-depth: 0
    - name: Build sdist
      uses: PyO3/maturin-action@v1
      with:
        command: sdist
        args: --out dist
        working-directory: ./sqlglotrs
    - name: Upload sdist
      uses: actions/upload-artifact@v4
      with:
        name: wheels-sdist
        path: sqlglotrs/dist

  deploy-rs:
    needs: [should-deploy-rs, build-rs, sdist-rs]
    if: needs.should-deploy-rs.outputs.deploy == 'true'
    runs-on: ubuntu-latest
    steps:
    - uses: actions/download-artifact@v4
      with:
        pattern: wheels-*
        path: sqlglotrs/dist
    - name: Publish to PyPI
      uses: PyO3/maturin-action@v1
      env:
        MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
      with:
        command: upload
        args: --non-interactive --skip-existing dist/wheels-*/*
        working-directory: ./sqlglotrs

  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
    - uses: actions/checkout@v5
      with:
        fetch-depth: 0
    - name: Set up Python
      uses: actions/setup-python@v3
      with:
        python-version: "3.10"
    - name: Install dependencies
      run: |
        python -m venv .venv
        source ./.venv/bin/activate
        python -m pip install --upgrade pip
        pip install build twine
        make install-dev
    - name: Build and publish
      env:
        TWINE_USERNAME: __token__
        TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
      run: |
        source ./.venv/bin/activate
        python -m build
        twine upload dist/*
    - name: Update CHANGELOG
      id: changelog
      continue-on-error: true
      uses: requarks/changelog-action@v1
      with:
        token: ${{ github.token }}
        tag: ${{ github.ref_name }}
    - name: Commit CHANGELOG.md
      continue-on-error: true
      uses: stefanzweifel/git-auto-commit-action@v4
      with:
        branch: main
        commit_message: "Update CHANGELOG.md for ${{ github.ref_name }} [skip ci]"
        file_pattern: "CHANGELOG.md"
    - name: Update API docs
      run: |
        git checkout api-docs
        source ./.venv/bin/activate
        make docs
    - name: Commit API docs
      uses: stefanzweifel/git-auto-commit-action@v4
      with:
        branch: api-docs
        commit_message: 'Update API docs for ${{ github.ref_name }} [skip ci]'
        file_pattern: 'docs'