|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + release-version: |
| 7 | + type: string |
| 8 | + required: true |
| 9 | + description: 'Version number (for example: 0.1.0)' |
| 10 | + is-latest: |
| 11 | + description: 'Select if the built image should be tagged as latest' |
| 12 | + required: true |
| 13 | + type: boolean |
| 14 | + quay-organization: |
| 15 | + description: 'Quay organization used to push the built images to' |
| 16 | + required: true |
| 17 | + default: 'project-codeflare' |
| 18 | + python_version: |
| 19 | + type: string |
| 20 | + default: "3.8" |
| 21 | + required: true |
| 22 | + poetry_version: |
| 23 | + type: string |
| 24 | + default: "1.5.1" |
| 25 | + required: true |
| 26 | + |
| 27 | +jobs: |
| 28 | + release: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + permissions: |
| 31 | + contents: write |
| 32 | + steps: |
| 33 | + - name: Checkout the repository |
| 34 | + uses: actions/checkout@v3 |
| 35 | + - name: Install Python |
| 36 | + uses: actions/setup-python@v4 |
| 37 | + with: |
| 38 | + python-version: ${{ github.event.inputs.python_version }} |
| 39 | + - name: Install Poetry |
| 40 | + uses: abatilo/actions-poetry@v2 |
| 41 | + with: |
| 42 | + poetry-version: ${{ github.event.inputs.poetry_version }} |
| 43 | + - name: Change version in pyproject.toml |
| 44 | + run: poetry version "${{ github.event.inputs.release-version }}" |
| 45 | + - name: Run poetry install |
| 46 | + run: poetry install --with docs |
| 47 | + - name: Run poetry build |
| 48 | + run: poetry build |
| 49 | + - name: Create new documentation |
| 50 | + run: poetry run pdoc --html -o docs src/codeflare_sdk && pushd docs && rm -rf cluster job utils && mv codeflare_sdk/* . && rm -rf codeflare_sdk && popd |
| 51 | + - name: Set Pypi token |
| 52 | + run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} |
| 53 | + - name: Publish new release to Pypi repository |
| 54 | + run: poetry publish |
| 55 | + |
| 56 | + - name: Commit changes in docs |
| 57 | + uses: stefanzweifel/git-auto-commit-action@v4 |
| 58 | + with: |
| 59 | + file_pattern: 'docs' |
| 60 | + commit_message: "Changes in docs for release: v${{ github.event.inputs.release-version }}" |
| 61 | + - name: Create Github release |
| 62 | + uses: ncipollo/release-action@v1 |
| 63 | + with: |
| 64 | + tag: "v${{ github.event.inputs.release-version }}" |
| 65 | + |
| 66 | + - name: Image Build |
| 67 | + run: | |
| 68 | + cd custom-nb-image |
| 69 | + docker build --build-arg SDK_VERSION="${{ github.event.inputs.release-version }}" -t quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }} . |
| 70 | + docker tag quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }} quay.io/${{ github.event.inputs.quay-organization }}/notebook:latest |
| 71 | + - name: Login to Quay.io |
| 72 | + uses: docker/login-action@v2 |
| 73 | + with: |
| 74 | + registry: quay.io |
| 75 | + username: ${{ secrets.QUAY_ID }} |
| 76 | + password: ${{ secrets.QUAY_TOKEN }} |
| 77 | + - name: Image Push |
| 78 | + run: docker push quay.io/${{ github.event.inputs.quay-organization }}/notebook:v${{ github.event.inputs.release-version }} |
| 79 | + - name: Image Push Latest |
| 80 | + if: ${{ inputs.is-latest }} |
| 81 | + run: docker push quay.io/${{ github.event.inputs.quay-organization }}/notebook:latest |
0 commit comments