Skip to content

Commit 01826b6

Browse files
committed
Release workflow opens PR with changes
1 parent fb34ba4 commit 01826b6

File tree

1 file changed

+28
-8
lines changed

1 file changed

+28
-8
lines changed

.github/workflows/release.yaml

+28-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,36 @@ 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+
if git branch -a | grep "${{ env.PR_BRANCH_NAME }}"; then
64+
GIT_BRANCH=${GITHUB_REF#refs/heads/}
65+
gh pr create --base "$GIT_BRANCH" --fill --head "${{ env.PR_BRANCH_NAME }}" --label "lgtm" --label "approved"
66+
fi
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.CODEFLARE_MACHINE_ACCOUNT_TOKEN }}
69+
- name: Wait until PR with code changes is merged
70+
run: |
71+
if git branch -a | grep "${{ env.PR_BRANCH_NAME }}"; then
72+
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'
73+
fi
74+
env:
75+
GITHUB_TOKEN: ${{ github.TOKEN }}
6576

6677
- name: Image Build
6778
run: |
6879
cd custom-nb-image
6980
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 }} .
7081
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
82+
7183
- name: Login to Quay.io
7284
uses: docker/login-action@v2
7385
with:
@@ -79,3 +91,11 @@ jobs:
7991
- name: Image Push Latest
8092
if: ${{ inputs.is-latest }}
8193
run: docker push quay.io/${{ github.event.inputs.quay-organization }}/notebook:latest
94+
- name: Create Github release
95+
uses: ncipollo/release-action@v1
96+
with:
97+
tag: "v${{ github.event.inputs.release-version }}"
98+
- name: Set Pypi token
99+
run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
100+
- name: Publish new release to Pypi repository
101+
run: poetry publish

0 commit comments

Comments
 (0)