|
5 | 5 | tags: |
6 | 6 | - "*.*.*" |
7 | 7 | jobs: |
8 | | - test-changelog: |
9 | | - runs-on: ubuntu-latest |
10 | | - steps: |
11 | | - - uses: actions/checkout@v2 |
12 | | - - name: Get changelog entry |
13 | | - id: changelog_reader |
14 | | - uses: guzman-raphael/changelog-reader-action@v5 |
15 | | - with: |
16 | | - path: ./CHANGELOG.md |
17 | | - - name: Verify changelog parsing |
18 | | - env: |
19 | | - TAG_NAME: ${{steps.changelog_reader.outputs.version}} |
20 | | - RELEASE_NAME: Release ${{steps.changelog_reader.outputs.version}} |
21 | | - BODY: ${{steps.changelog_reader.outputs.changes}} |
22 | | - PRERELEASE: ${{steps.changelog_reader.outputs.status == 'prereleased'}} |
23 | | - DRAFT: ${{steps.changelog_reader.outputs.status == 'unreleased'}} |
24 | | - run: | |
25 | | - echo "TAG_NAME=${TAG_NAME}" |
26 | | - echo "RELEASE_NAME=${RELEASE_NAME}" |
27 | | - echo "BODY=${BODY}" |
28 | | - echo "PRERELEASE=${PRERELEASE}" |
29 | | - echo "DRAFT=${DRAFT}" |
30 | | - build: |
31 | | - needs: test-changelog |
32 | | - runs-on: ubuntu-latest |
33 | | - strategy: |
34 | | - matrix: |
35 | | - include: |
36 | | - - py_ver: 3.8 |
37 | | - distro: alpine |
38 | | - image: djbase |
39 | | - env: |
40 | | - PY_VER: ${{matrix.py_ver}} |
41 | | - DISTRO: ${{matrix.distro}} |
42 | | - IMAGE: ${{matrix.image}} |
43 | | - DOCKER_CLIENT_TIMEOUT: "120" |
44 | | - COMPOSE_HTTP_TIMEOUT: "120" |
45 | | - steps: |
46 | | - - uses: actions/checkout@v2 |
47 | | - - name: Compile image |
48 | | - run: | |
49 | | - export PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if '.' not in p][0])") |
50 | | - export PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__ = / {print $2}') |
51 | | - export HOST_UID=$(id -u) |
52 | | - docker-compose -f docker-compose-build.yaml up --exit-code-from element --build |
53 | | - IMAGE=$(docker images --filter "reference=datajoint/${PKG_NAME}*" \ |
54 | | - --format "{{.Repository}}") |
55 | | - TAG=$(docker images --filter "reference=datajoint/${PKG_NAME}*" --format "{{.Tag}}") |
56 | | - docker save "${IMAGE}:${TAG}" | \ |
57 | | - gzip > "image-${PKG_NAME}-${PKG_VERSION}-py${PY_VER}-${DISTRO}.tar.gz" |
58 | | - echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV |
59 | | - echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV |
60 | | - - name: Add image artifact |
61 | | - uses: actions/upload-artifact@v2 |
62 | | - with: |
63 | | - name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}} |
64 | | - path: |
65 | | - "image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-\ |
66 | | - ${{matrix.distro}}.tar.gz" |
67 | | - retention-days: 1 |
68 | | - - if: matrix.py_ver == '3.8' && matrix.distro == 'alpine' |
69 | | - name: Add pip artifacts |
70 | | - uses: actions/upload-artifact@v2 |
71 | | - with: |
72 | | - name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}} |
73 | | - path: dist |
74 | | - retention-days: 1 |
75 | | - publish-release: |
76 | | - if: github.event_name == 'push' |
77 | | - needs: build |
78 | | - runs-on: ubuntu-latest |
79 | | - env: |
80 | | - TWINE_USERNAME: ${{secrets.twine_username}} |
81 | | - TWINE_PASSWORD: ${{secrets.twine_password}} |
82 | | - outputs: |
83 | | - release_upload_url: ${{steps.create_gh_release.outputs.upload_url}} |
84 | | - steps: |
85 | | - - uses: actions/checkout@v2 |
86 | | - - name: Determine package version |
87 | | - run: | |
88 | | - PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if '.' not in p][0])") |
89 | | - SDIST_PKG_NAME=$(echo ${PKG_NAME} | sed 's|_|-|g') |
90 | | - PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__ = / {print $2}') |
91 | | - echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV |
92 | | - echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV |
93 | | - echo "SDIST_PKG_NAME=${SDIST_PKG_NAME}" >> $GITHUB_ENV |
94 | | - - name: Get changelog entry |
95 | | - id: changelog_reader |
96 | | - uses: guzman-raphael/changelog-reader-action@v5 |
97 | | - with: |
98 | | - path: ./CHANGELOG.md |
99 | | - version: ${{env.PKG_VERSION}} |
100 | | - - name: Create GH release |
101 | | - id: create_gh_release |
102 | | - uses: actions/create-release@v1 |
103 | | - env: |
104 | | - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
105 | | - with: |
106 | | - tag_name: ${{steps.changelog_reader.outputs.version}} |
107 | | - release_name: Release ${{steps.changelog_reader.outputs.version}} |
108 | | - body: ${{steps.changelog_reader.outputs.changes}} |
109 | | - prerelease: ${{steps.changelog_reader.outputs.status == 'prereleased'}} |
110 | | - draft: ${{steps.changelog_reader.outputs.status == 'unreleased'}} |
111 | | - - name: Fetch image artifact |
112 | | - uses: actions/download-artifact@v2 |
113 | | - with: |
114 | | - name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py3.8-alpine |
115 | | - - name: Fetch pip artifacts |
116 | | - uses: actions/download-artifact@v2 |
117 | | - with: |
118 | | - name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}} |
119 | | - path: dist |
120 | | - - name: Publish pip release |
121 | | - run: | |
122 | | - export HOST_UID=$(id -u) |
123 | | - docker load < "image-${{env.PKG_NAME}}-${PKG_VERSION}-py3.8-alpine.tar.gz" |
124 | | - docker-compose -f docker-compose-build.yaml run \ |
125 | | - -e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} element \ |
126 | | - sh -lc "pip install twine && python -m twine upload dist/*" |
127 | | - - name: Determine pip artifact paths |
128 | | - run: | |
129 | | - echo "PKG_WHEEL_PATH=$(ls dist/${PKG_NAME}-*.whl)" >> $GITHUB_ENV |
130 | | - echo "PKG_SDIST_PATH=$(ls dist/${SDIST_PKG_NAME}-*.tar.gz)" >> $GITHUB_ENV |
131 | | - - name: Upload pip wheel asset to release |
132 | | - uses: actions/upload-release-asset@v1 |
133 | | - env: |
134 | | - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
135 | | - with: |
136 | | - upload_url: ${{steps.create_gh_release.outputs.upload_url}} |
137 | | - asset_path: ${{env.PKG_WHEEL_PATH}} |
138 | | - asset_name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}}.whl |
139 | | - asset_content_type: application/zip |
140 | | - - name: Upload pip sdist asset to release |
141 | | - uses: actions/upload-release-asset@v1 |
142 | | - env: |
143 | | - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
144 | | - with: |
145 | | - upload_url: ${{steps.create_gh_release.outputs.upload_url}} |
146 | | - asset_path: ${{env.PKG_SDIST_PATH}} |
147 | | - asset_name: pip-${{env.SDIST_PKG_NAME}}-${{env.PKG_VERSION}}.tar.gz |
148 | | - asset_content_type: application/gzip |
| 8 | + # test-changelog: |
| 9 | + # runs-on: ubuntu-latest |
| 10 | + # steps: |
| 11 | + # - uses: actions/checkout@v2 |
| 12 | + # - name: Get changelog entry |
| 13 | + # id: changelog_reader |
| 14 | + # uses: guzman-raphael/changelog-reader-action@v5 |
| 15 | + # with: |
| 16 | + # path: ./CHANGELOG.md |
| 17 | + # - name: Verify changelog parsing |
| 18 | + # env: |
| 19 | + # TAG_NAME: ${{steps.changelog_reader.outputs.version}} |
| 20 | + # RELEASE_NAME: Release ${{steps.changelog_reader.outputs.version}} |
| 21 | + # BODY: ${{steps.changelog_reader.outputs.changes}} |
| 22 | + # PRERELEASE: ${{steps.changelog_reader.outputs.status == 'prereleased'}} |
| 23 | + # DRAFT: ${{steps.changelog_reader.outputs.status == 'unreleased'}} |
| 24 | + # run: | |
| 25 | + # echo "TAG_NAME=${TAG_NAME}" |
| 26 | + # echo "RELEASE_NAME=${RELEASE_NAME}" |
| 27 | + # echo "BODY=${BODY}" |
| 28 | + # echo "PRERELEASE=${PRERELEASE}" |
| 29 | + # echo "DRAFT=${DRAFT}" |
| 30 | + # build: |
| 31 | + # needs: test-changelog |
| 32 | + # runs-on: ubuntu-latest |
| 33 | + # strategy: |
| 34 | + # matrix: |
| 35 | + # include: |
| 36 | + # - py_ver: 3.8 |
| 37 | + # distro: alpine |
| 38 | + # image: djbase |
| 39 | + # env: |
| 40 | + # PY_VER: ${{matrix.py_ver}} |
| 41 | + # DISTRO: ${{matrix.distro}} |
| 42 | + # IMAGE: ${{matrix.image}} |
| 43 | + # DOCKER_CLIENT_TIMEOUT: "120" |
| 44 | + # COMPOSE_HTTP_TIMEOUT: "120" |
| 45 | + # steps: |
| 46 | + # - uses: actions/checkout@v2 |
| 47 | + # - name: Compile image |
| 48 | + # run: | |
| 49 | + # export PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if '.' not in p][0])") |
| 50 | + # export PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__ = / {print $2}') |
| 51 | + # export HOST_UID=$(id -u) |
| 52 | + # docker-compose -f docker-compose-build.yaml up --exit-code-from element --build |
| 53 | + # IMAGE=$(docker images --filter "reference=datajoint/${PKG_NAME}*" \ |
| 54 | + # --format "{{.Repository}}") |
| 55 | + # TAG=$(docker images --filter "reference=datajoint/${PKG_NAME}*" --format "{{.Tag}}") |
| 56 | + # docker save "${IMAGE}:${TAG}" | \ |
| 57 | + # gzip > "image-${PKG_NAME}-${PKG_VERSION}-py${PY_VER}-${DISTRO}.tar.gz" |
| 58 | + # echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV |
| 59 | + # echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV |
| 60 | + # - name: Add image artifact |
| 61 | + # uses: actions/upload-artifact@v2 |
| 62 | + # with: |
| 63 | + # name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}} |
| 64 | + # path: |
| 65 | + # "image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-\ |
| 66 | + # ${{matrix.distro}}.tar.gz" |
| 67 | + # retention-days: 1 |
| 68 | + # - if: matrix.py_ver == '3.8' && matrix.distro == 'alpine' |
| 69 | + # name: Add pip artifacts |
| 70 | + # uses: actions/upload-artifact@v2 |
| 71 | + # with: |
| 72 | + # name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}} |
| 73 | + # path: dist |
| 74 | + # retention-days: 1 |
| 75 | + # publish-release: |
| 76 | + # if: github.event_name == 'push' |
| 77 | + # needs: build |
| 78 | + # runs-on: ubuntu-latest |
| 79 | + # env: |
| 80 | + # TWINE_USERNAME: ${{secrets.twine_username}} |
| 81 | + # TWINE_PASSWORD: ${{secrets.twine_password}} |
| 82 | + # outputs: |
| 83 | + # release_upload_url: ${{steps.create_gh_release.outputs.upload_url}} |
| 84 | + # steps: |
| 85 | + # - uses: actions/checkout@v2 |
| 86 | + # - name: Determine package version |
| 87 | + # run: | |
| 88 | + # PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if '.' not in p][0])") |
| 89 | + # SDIST_PKG_NAME=$(echo ${PKG_NAME} | sed 's|_|-|g') |
| 90 | + # PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\' '/__version__ = / {print $2}') |
| 91 | + # echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV |
| 92 | + # echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV |
| 93 | + # echo "SDIST_PKG_NAME=${SDIST_PKG_NAME}" >> $GITHUB_ENV |
| 94 | + # - name: Get changelog entry |
| 95 | + # id: changelog_reader |
| 96 | + # uses: guzman-raphael/changelog-reader-action@v5 |
| 97 | + # with: |
| 98 | + # path: ./CHANGELOG.md |
| 99 | + # version: ${{env.PKG_VERSION}} |
| 100 | + # - name: Create GH release |
| 101 | + # id: create_gh_release |
| 102 | + # uses: actions/create-release@v1 |
| 103 | + # env: |
| 104 | + # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 105 | + # with: |
| 106 | + # tag_name: ${{steps.changelog_reader.outputs.version}} |
| 107 | + # release_name: Release ${{steps.changelog_reader.outputs.version}} |
| 108 | + # body: ${{steps.changelog_reader.outputs.changes}} |
| 109 | + # prerelease: ${{steps.changelog_reader.outputs.status == 'prereleased'}} |
| 110 | + # draft: ${{steps.changelog_reader.outputs.status == 'unreleased'}} |
| 111 | + # - name: Fetch image artifact |
| 112 | + # uses: actions/download-artifact@v2 |
| 113 | + # with: |
| 114 | + # name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py3.8-alpine |
| 115 | + # - name: Fetch pip artifacts |
| 116 | + # uses: actions/download-artifact@v2 |
| 117 | + # with: |
| 118 | + # name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}} |
| 119 | + # path: dist |
| 120 | + # - name: Publish pip release |
| 121 | + # run: | |
| 122 | + # export HOST_UID=$(id -u) |
| 123 | + # docker load < "image-${{env.PKG_NAME}}-${PKG_VERSION}-py3.8-alpine.tar.gz" |
| 124 | + # docker-compose -f docker-compose-build.yaml run \ |
| 125 | + # -e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} element \ |
| 126 | + # sh -lc "pip install twine && python -m twine upload dist/*" |
| 127 | + # - name: Determine pip artifact paths |
| 128 | + # run: | |
| 129 | + # echo "PKG_WHEEL_PATH=$(ls dist/${PKG_NAME}-*.whl)" >> $GITHUB_ENV |
| 130 | + # echo "PKG_SDIST_PATH=$(ls dist/${SDIST_PKG_NAME}-*.tar.gz)" >> $GITHUB_ENV |
| 131 | + # - name: Upload pip wheel asset to release |
| 132 | + # uses: actions/upload-release-asset@v1 |
| 133 | + # env: |
| 134 | + # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 135 | + # with: |
| 136 | + # upload_url: ${{steps.create_gh_release.outputs.upload_url}} |
| 137 | + # asset_path: ${{env.PKG_WHEEL_PATH}} |
| 138 | + # asset_name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}}.whl |
| 139 | + # asset_content_type: application/zip |
| 140 | + # - name: Upload pip sdist asset to release |
| 141 | + # uses: actions/upload-release-asset@v1 |
| 142 | + # env: |
| 143 | + # GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 144 | + # with: |
| 145 | + # upload_url: ${{steps.create_gh_release.outputs.upload_url}} |
| 146 | + # asset_path: ${{env.PKG_SDIST_PATH}} |
| 147 | + # asset_name: pip-${{env.SDIST_PKG_NAME}}-${{env.PKG_VERSION}}.tar.gz |
| 148 | + # asset_content_type: application/gzip |
149 | 149 | deploy-docs: |
150 | 150 | runs-on: ubuntu-latest |
151 | 151 | steps: |
|
0 commit comments