-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update release flow for BCK prerelease and final release #12453
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,25 @@ on: | |
types: [published] | ||
|
||
jobs: | ||
latest_release: | ||
name: Check if this release is the latest release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
is_latest_release: ${{ steps.is_latest_release.outputs.result }} | ||
steps: | ||
- name: Check if the current release is the latest Kolibri release | ||
id: is_latest_release | ||
uses: actions/github-script@v7 | ||
with: | ||
result-encoding: string | ||
script: | | ||
|
||
const { data: latestRelease } = await github.rest.repos.getLatestRelease({ | ||
owner: 'learningequality', | ||
repo: 'kolibri', | ||
}); | ||
|
||
return latestRelease.tag_name === '${{ github.event.release.tag_name }}'; | ||
whl: | ||
name: Build WHL file | ||
uses: ./.github/workflows/build_whl.yml | ||
|
@@ -160,6 +179,40 @@ jobs: | |
with: | ||
path: 'dist/${{ matrix.filename }}' | ||
destination: '${{ secrets.KOLIBRI_PUBLIC_RELEASE_GCS_BUCKET }}/downloads/kolibri/${{ github.event.release.name }}' | ||
bck_prerelease_gcs_upload: | ||
name: Upload WHL file to Google Cloud Storage for BCK Pre-release | ||
runs-on: ubuntu-latest | ||
needs: [whl] | ||
steps: | ||
- name: Download WHL artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ needs.whl.outputs.whl-file-name }} | ||
path: dist | ||
- name: Zip whl file | ||
run: zip -j dist/kolibri.zip dist/${{ needs.whl.outputs.whl-file-name }} | ||
- uses: 'google-github-actions/auth@v2' | ||
with: | ||
credentials_json: '${{ secrets.GH_UPLOADER_GCP_SA_CREDENTIALS }}' | ||
- name: 'Set up Cloud SDK' | ||
uses: 'google-github-actions/setup-gcloud@v2' | ||
- name: Upload to BCK bucket | ||
uses: 'google-github-actions/upload-cloud-storage@v2' | ||
with: | ||
path: 'dist/kolibri.zip' | ||
destination: '${{ secrets.BCK_PRERELEASE_BUILD_ARTIFACT_GCS_BUCKET }}' | ||
Comment on lines
+202
to
+203
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was initially concerned by this, but if the docs are telling the truth, should be uploaded flat. And so this may be alright. |
||
parent: false | ||
- name: Unzip content static files from whl file | ||
run: | | ||
unzip -j dist/${{ needs.whl.outputs.whl-file-name }} 'kolibri/core/content/static/*' -d static | ||
rm static/*.file_size | ||
# Ungzip all .gz files in the static folder | ||
for f in static/*.gz; do gunzip -f $f; done | ||
Comment on lines
+207
to
+210
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeesh you fancy with your bash functions There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This all looks fine to me, though you're doing more than the old buildkite step was doing; makes sense, given you're pulling from a WHL rather than the source code — do you not have access to the source code, or is it just safer to use the artifact we know successfully built? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By this point in the step, the built source has been gzipped and truncated to keep the overall whl file smaller, so we have to do this to reinflate it back to uncompressed sources. And yes, definitely safer to use the files we know have built successfully into the whl file. |
||
- name: Upload content static files to BCK bucket | ||
uses: 'google-github-actions/upload-cloud-storage@v2' | ||
with: | ||
path: 'static' | ||
destination: '${{ secrets.STUDIO_BCK_CONTENT_STATIC_BUCKET }}' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The the bajillion examples of the not-immediately-intuitive behaviour on upload described in the docs has be squinting suspiciously at this. But if my understanding is right, all the extracted folders should start at the root of the bucket. Which is what I believe Kolibri-modified-to-point-at-a-bucket-for-content is expecting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes - the docs are highly confusing, but this is also why I unzipped all the static files into the root of the current directory, so that I could just say "upload this folder". I am fully ready for my having misunderstood the docs again, again, again. |
||
block_release_step: | ||
# This step ties to the release environment which requires manual approval | ||
# before it can execute. Once manual approval has been granted, the release is | ||
|
@@ -187,9 +240,9 @@ jobs: | |
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | ||
bck_gcs_upload: | ||
name: Upload WHL file to Google Cloud Storage for BCK | ||
if: ${{ !github.event.release.prerelease && github.event.release.name == 'latest'}} | ||
needs: [block_release_step, whl, latest_release] | ||
if: ${{ !github.event.release.prerelease && needs.latest_release.outputs.is_latest_release == 'true' }} | ||
runs-on: ubuntu-latest | ||
needs: [block_release_step, whl] | ||
steps: | ||
- name: Download WHL artifact | ||
uses: actions/download-artifact@v4 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming that the filename looks like it does in the PR comment (
kolibri-0.17.0b3.dev0+git.3.gb6d89f4b-py2.py3-none-any.whl
), this looks like it'd install just fine, yep. Link to relevant lines in the CD dockerfile