File: release.yml

package info (click to toggle)
thumbor 7.7.7-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 40,556 kB
  • sloc: xml: 295,435; python: 18,673; ansic: 1,479; makefile: 360; sh: 27
file content (189 lines) | stat: -rw-r--r-- 5,258 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
---
name: release
on:
  push:
    tags:
      - "[0-9]+.[0-9]+.[0-9]+"
  pull_request:
    branches:
      - "master"

permissions:
  contents: read
  packages: write

env:
  CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
  python-version: "3.10"

jobs:
  # Heavily inspired on https://github.com/tornadoweb/tornado/blob/master/.github/workflows/build.yml
  build_sdist:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python
        id: setup-python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.python-version }}
      - name: Install dependencies
        run: |
          pip install -U pip
      - name: Build package
        run: python setup.py sdist

      - uses: actions/upload-artifact@v4
        with:
          name: artifact-sdist
          path: ./dist/thumbor-*.tar.gz

  build_wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os:
          - ubuntu-latest
          - macOS-latest

    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        name: Install Python
        with:
          python-version: ${{ env.python-version }}
      - name: Set up QEMU
        if: runner.os == 'Linux'
        uses: docker/setup-qemu-action@v3
        with:
          platforms: all

      - name: Build wheels
        uses: pypa/cibuildwheel@v2.23.3

      - uses: actions/upload-artifact@v4
        with:
          name: artifact-${{ matrix.os }}
          path: ./wheelhouse/*.whl
          overwrite: true

  upload_pypi:
    name: Upload to PyPI
    needs: [build_wheels, build_sdist]
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: artifact-*
          path: dist
          merge-multiple: true

      - run: ls -lah dist

      - uses: pypa/gh-action-pypi-publish@v1.12.4
        if: github.event_name != 'pull_request'
        with:
          user: __token__
          password: ${{ secrets.PYPI_API_TOKEN }}
          skip-existing: true

  docker:
    needs: upload_pypi
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python_version:
          - "3.9"
          - "3.10"
          - "3.11"
          - "3.12"
          - "3.13"
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: "0"

      - uses: actions/download-artifact@v4
        with:
          pattern: artifact-*
          path: dist
          merge-multiple: true

      - name: Set output on new tags
        if: github.event_name != 'pull_request'
        run: echo "THUMBOR_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

      - name: Set output on PR
        if: github.event_name == 'pull_request'
        run: echo "THUMBOR_VERSION=$(cat thumbor/__init__.py | grep "__version__" | cut -d'"' -f2)" >> $GITHUB_ENV

      - name: Enable docker cache push
        if: github.event_name != 'pull_request'
        run: echo "CACHE_TO=type=registry,ref=ghcr.io/thumbor/thumbor:buildcache-${{ matrix.python_version }},mode=max" >> $GITHUB_ENV

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v3

      - name: Login to GHCR
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.repository_owner }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Login to Quay.io
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v3
        with:
          registry: quay.io
          username: ${{ secrets.QUAY_IO_USERNAME }}
          password: ${{ secrets.QUAY_IO_PASSWORD }}

      - name: Login to Docker Hub
        if: github.event_name != 'pull_request'
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_PASSWORD }}

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v5
        with:
          flavor: |
            suffix=-py-${{ matrix.python_version }}
          images: |
            ghcr.io/thumbor/thumbor
            quay.io/thumbor/thumbor
            thumbororg/thumbor
          tags: |
            type=schedule
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}
            type=sha

      - name: Build and push
        uses: docker/build-push-action@v5
        with:
          context: .
          file: ./docker/Dockerfile
          platforms: linux/amd64,linux/arm64
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=registry,ref=ghcr.io/thumbor/thumbor:buildcache-${{ matrix.python_version }}
          cache-to: ${{ env.CACHE_TO }}
          build-args: |
            THUMBOR_VERSION=${{ env.THUMBOR_VERSION }}
            PYTHON_VERSION=${{ matrix.python_version }}