Skip to content

Commit 242c244

Browse files
committed
Release workflow opens PR with changes
1 parent 9dd4e3f commit 242c244

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

.github/workflows/release.yaml

+24-8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
runs-on: ubuntu-latest
3030
permissions:
3131
contents: write
32+
env:
33+
PR_BRANCH_NAME: adjustments-release-${{ github.event.inputs.release-version }}
3234
steps:
3335
- name: Checkout the repository
3436
uses: actions/checkout@v3
@@ -48,26 +50,32 @@ jobs:
4850
run: poetry build
4951
- name: Create new documentation
5052
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 && find docs -type f -name "*.html" -exec bash -c "echo '' >> {}" \;
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
5553

5654
- name: Commit changes in docs
5755
uses: stefanzweifel/git-auto-commit-action@v4
5856
with:
5957
file_pattern: 'docs'
6058
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 }}"
59+
create_branch: true
60+
branch: ${{ env.PR_BRANCH_NAME }}
61+
- name: Create a PR with code changes
62+
run: |
63+
GIT_BRANCH=${GITHUB_REF#refs/heads/}
64+
gh pr create --base "$GIT_BRANCH" --fill --head "${{ env.PR_BRANCH_NAME }}" --label "lgtm" --label "approved"
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
67+
- name: Wait until PR with code changes is merged
68+
run: |
69+
timeout 3600 bash -c 'until [[ $(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state) == "MERGED" ]]; do sleep 5 && echo "$(gh pr view '${{ env.PR_BRANCH_NAME }}' --json state --jq .state)"; done'
70+
env:
71+
GITHUB_TOKEN: ${{ github.TOKEN }}
6572

6673
- name: Image Build
6774
run: |
6875
cd custom-nb-image
6976
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 }} .
7077
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
78+
7179
- name: Login to Quay.io
7280
uses: docker/login-action@v2
7381
with:
@@ -79,3 +87,11 @@ jobs:
7987
- name: Image Push Latest
8088
if: ${{ inputs.is-latest }}
8189
run: docker push quay.io/${{ github.event.inputs.quay-organization }}/notebook:latest
90+
- name: Create Github release
91+
uses: ncipollo/release-action@v1
92+
with:
93+
tag: "v${{ github.event.inputs.release-version }}"
94+
- name: Set Pypi token
95+
run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
96+
- name: Publish new release to Pypi repository
97+
run: poetry publish

0 commit comments

Comments
 (0)