diff --git a/.github/ISSUE_TEMPLATE/release.md b/.github/ISSUE_TEMPLATE/release.md index ba66bc187..bf5241ed8 100644 --- a/.github/ISSUE_TEMPLATE/release.md +++ b/.github/ISSUE_TEMPLATE/release.md @@ -21,14 +21,7 @@ VERSION=X.Y.Z-rc? make set_version Then: - [ ] For non RC releases: check the release milestone issues, cut out what can't be completed in time and change the milestones for these issues - [ ] Checkout the commit for release, create a signed tag (requires GPG keys setup, see [here](https://docs.github.com/en/github/authenticating-to-github/managing-commit-signature-verification)) with the version name (careful for RC) `git tag -s -a -m "vX.Y.Z release" vX.Y.Z`, (or `vX.Y.Z-rc?`) push it to GitHub with `git push origin refs/tags/vX.Y.Z` (or `vX.Y.Z-rc?`) -- [ ] Wait for the release workflow to finish and get the image url from the notification or the logs -- [ ] See [here](https://docs.github.com/en/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release) to create the release in GitHub using the existing tag, add the pull link copied from the step before \(`ghcr.io/zama-ai/concretefhe:vX.Y.Z`\) (or `vX.Y.Z-rc?`) for the uploaded docker image. Mark release as pre-release for an `rc` version. See template below: - -This is the release markdown template you should copy and update: -``` -**Docker Image:** ghcr.io/zama-ai/concretefhe:vX.Y.Z -**Documentation:** https://docs.zama.ai/concrete/ -``` +- [ ] Wait for the release workflow to finish and check everything went well. To continue the release cycle: - [ ] Choose the version number for next release, e.g. `vA.B.C` (can be `vA.B.C-rc?` for Release Candidates) following semantic versioning: https://semver.org/ diff --git a/.github/workflows/continuous-integration.yaml b/.github/workflows/continuous-integration.yaml index aec95822f..210a5a7d3 100644 --- a/.github/workflows/continuous-integration.yaml +++ b/.github/workflows/continuous-integration.yaml @@ -154,7 +154,9 @@ jobs: shell: '/usr/bin/bash -e {0}' strategy: matrix: - python-version: [3.8] + # YAML footgun : https://twitter.com/webology/status/1445394072492023811?s=20 + # Versions need to be quoted or risk being interpreted as floating point numbers + python-version: ["3.8"] outputs: report: ${{ steps.report.outputs.report || 'Did not run.' }} @@ -470,11 +472,10 @@ jobs: path: | ~/.cache/pip ~/.cache/pypoetry - # Ignore line break in the evaluated double quoted string - key: "${{ runner.os }}-build-${{ matrix.python-version }}-\ - ${{ hashFiles('poetry.lock') }}" + # Use python 3.8 as it is the version available in ubuntu 20.04 and we develop with it + key: "${{ runner.os }}-build-3.8-${{ hashFiles('poetry.lock') }}" restore-keys: | - ${{ runner.os }}-build-${{ matrix.python-version }}- + ${{ runner.os }}-build-3.8- ${{ runner.os }}-build- ${{ runner.os }}- - name: Install dependencies @@ -485,6 +486,7 @@ jobs: - name: Set tag in env run: | GIT_TAG=$(echo "${{ github.ref }}" | sed 's/refs\/tags\///g') + echo "GIT_TAG=${GIT_TAG}" >> "$GITHUB_ENV" RELEASE_IMG_GIT_TAG="${RELEASE_IMAGE_BASE}:${GIT_TAG}" echo "RELEASE_IMG_GIT_TAG=${RELEASE_IMG_GIT_TAG}" >> "$GITHUB_ENV" RELEASE_IMG_TAGS_TO_PUSH="${RELEASE_IMG_GIT_TAG}" @@ -496,11 +498,15 @@ jobs: # We want the space separated list of versions to be expanded # shellcheck disable=SC2086 - REQUIRES_LATEST_TAG=$(poetry run python script/make_utils/version_utils.py \ + IS_LATEST_INFO=$(poetry run python script/make_utils/version_utils.py \ islatest \ --new-version "${GIT_TAG}" \ --existing-versions $EXISTING_TAGS) + REQUIRES_LATEST_TAG=$(echo "${IS_LATEST_INFO}" | jq -rc '.is_latest') + IS_PRERELEASE=$(echo "${IS_LATEST_INFO}" | jq -rc '.is_prerelease') + echo "IS_PRERELEASE=${IS_PRERELEASE}" >> "$GITHUB_ENV" + if [[ "${REQUIRES_LATEST_TAG}" == "true" ]]; then RELEASE_IMG_LATEST_TAG="${RELEASE_IMAGE_BASE}:latest" RELEASE_IMG_TAGS_TO_PUSH="${RELEASE_IMG_TAGS_TO_PUSH},${RELEASE_IMG_LATEST_TAG}" @@ -534,12 +540,61 @@ jobs: docker run --rm -v "$(pwd)"/docker/release_resources:/data \ "${RELEASE_IMG_GIT_TAG}" /bin/bash -c "python ./sanity_check.py" docker image push --all-tags "${RELEASE_IMAGE_BASE}" + - name: Create directory for artifacts + if: ${{ success() && !cancelled() }} + run: | + ARTIFACTS_RAW_DIR=/tmp/release_artifacts/raw/ + mkdir -p "${ARTIFACTS_RAW_DIR}" + echo "ARTIFACTS_RAW_DIR=${ARTIFACTS_RAW_DIR}" >> "$GITHUB_ENV" + + ARTIFACTS_PACKAGED_DIR=/tmp/release_artifacts/packaged/ + mkdir -p "${ARTIFACTS_PACKAGED_DIR}" + echo "ARTIFACTS_PACKAGED_DIR=${ARTIFACTS_PACKAGED_DIR}" >> "$GITHUB_ENV" + - name: Download Documentation + if: ${{ success() && !cancelled() }} + id: download-docs + uses: actions/download-artifact@3be87be14a055c47b01d3bd88f8fe02320a9bb60 + with: + name: html-docs + path: ${{ env.ARTIFACTS_RAW_DIR }}/html_docs/ + - name: Download changelog + if: ${{ success() && !cancelled() }} + id: download-changelog + uses: actions/download-artifact@3be87be14a055c47b01d3bd88f8fe02320a9bb60 + with: + name: changelog + path: ${{ env.ARTIFACTS_RAW_DIR }}/changelog/ + - name: Create ready to upload/packaged artifacts + if: ${{ success() && !cancelled() }} + env: + RAW_DOCS_DIR: ${{ steps.download-docs.outputs.download-path }} + RAW_CHANGELOG_DIR: ${{ steps.download-changelog.outputs.download-path }} + run: | + pushd "${RAW_DOCS_DIR}" + zip -r "${ARTIFACTS_PACKAGED_DIR}/html-docs.zip" ./* + tar -cvzf "${ARTIFACTS_PACKAGED_DIR}/html-docs.tar.gz" ./* + popd + cp "${RAW_CHANGELOG_DIR}/*" "${ARTIFACTS_PACKAGED_DIR}" + - name: Create GitHub release + if: ${{ success() && !cancelled() }} + id: create-release + uses: softprops/action-gh-release@6034af24fba4e5a8e975aaa6056554efe4c794d0 + with: + body: | + **Docker Image:** ${{ env.RELEASE_IMG_GIT_TAG }} + **Documentation:** https://docs.zama.ai/concrete/ + prerelease: ${{ fromJSON(env.IS_PRERELEASE) }} + files: | + '${{ env.ARTIFACTS_PACKAGED_DIR }}/*' + tag_name: ${{ env.GIT_TAG }} + fail_on_unmatched_files: true + token: ${{ secrets.BOT_TOKEN }} - name: Set notification report id: report if: ${{ always() }} run: | - REPORT="Pushing docker image ${{ env.RELEASE_IMG_TAGS_TO_PUSH }} finished with status \ - ${{ job.status }}." + REPORT="Creating release for ${GIT_TAG} finished with status ${{ job.status }}. \ + GitHub release link: ${{ steps.create-release.outputs.url }}." echo "${REPORT}" echo "::set-output name=report::${REPORT}" echo "REPORT=${REPORT}" >> "$GITHUB_ENV" diff --git a/script/make_utils/version_utils.py b/script/make_utils/version_utils.py index 58150f36f..f8a58ac38 100644 --- a/script/make_utils/version_utils.py +++ b/script/make_utils/version_utils.py @@ -1,6 +1,7 @@ """Tool to manage version in the project""" import argparse +import json import os import re import sys @@ -20,7 +21,8 @@ def islatest(args): """islatest command entry point.""" print(args, file=sys.stderr) - new_version_is_latest = False + # This is the safest default + result = {"is_latest": False, "is_prerelease": True} new_version_str = strip_leading_v(args.new_version) if VersionInfo.isvalid(new_version_str): @@ -43,7 +45,10 @@ def islatest(args): all_non_prerelease_version_infos.append(new_version_info) new_version_is_latest = max(all_non_prerelease_version_infos) == new_version_info - print(str(new_version_is_latest).lower()) + result["is_latest"] = new_version_is_latest + result["is_prerelease"] = False + + print(json.dumps(result)) def update_variable_in_py_file(file_path: Path, var_name: str, version_str: str):