|
5 | 5 | tags:
|
6 | 6 | - '*.*.*'
|
7 | 7 | jobs:
|
| 8 | + build: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + include: |
| 13 | + - py_ver: 3.8 |
| 14 | + distro: alpine |
| 15 | + image: djbase |
| 16 | + env: |
| 17 | + PY_VER: ${{matrix.py_ver}} |
| 18 | + DISTRO: ${{matrix.distro}} |
| 19 | + IMAGE: ${{matrix.image}} |
| 20 | + DOCKER_CLIENT_TIMEOUT: "120" |
| 21 | + COMPOSE_HTTP_TIMEOUT: "120" |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + - name: Compile image |
| 25 | + run: | |
| 26 | + export PKG_NAME=$(cat setup.py | awk -F\' '/pkg_name = / {print $2}') |
| 27 | + export PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__ = / {print $2}') |
| 28 | + export HOST_UID=$(id -u) |
| 29 | + docker-compose -f docker-compose-build.yaml up --exit-code-from element --build |
| 30 | + IMAGE=$(docker images --filter "reference=datajoint/${PKG_NAME}*" \ |
| 31 | + --format "{{.Repository}}") |
| 32 | + TAG=$(docker images --filter "reference=datajoint/${PKG_NAME}*" --format "{{.Tag}}") |
| 33 | + docker save "${IMAGE}:${TAG}" | \ |
| 34 | + gzip > "image-${PKG_NAME}-${PKG_VERSION}-py${PY_VER}-${DISTRO}.tar.gz" |
| 35 | + echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV |
| 36 | + - name: Add image artifact |
| 37 | + uses: actions/upload-artifact@v2 |
| 38 | + with: |
| 39 | + name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}} |
| 40 | + path: "image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-\ |
| 41 | + ${{matrix.distro}}.tar.gz" |
| 42 | + retention-days: 1 |
| 43 | + - if: matrix.py_ver == '3.8' && matrix.distro == 'alpine' |
| 44 | + name: Add pip artifacts |
| 45 | + uses: actions/upload-artifact@v2 |
| 46 | + with: |
| 47 | + name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}} |
| 48 | + path: dist |
| 49 | + retention-days: 1 |
8 | 50 | publish-release:
|
9 | 51 | if: github.event_name == 'push'
|
| 52 | + needs: build |
10 | 53 | runs-on: ubuntu-latest
|
11 | 54 | env:
|
12 | 55 | TWINE_USERNAME: ${{secrets.twine_username}}
|
|
0 commit comments