Skip to content

Commit

Permalink
Filter release tags to current branch (holochain#2476)
Browse files Browse the repository at this point in the history
* Filter release tags to current branch

* Update .github/workflows/release-prepare.yml

Co-authored-by: Stefan Junker <1181362+steveej@users.noreply.github.com>

* Update .github/workflows/release-prepare.yml

Co-authored-by: Stefan Junker <1181362+steveej@users.noreply.github.com>

* Update .github/workflows/release-prepare.yml

Co-authored-by: Stefan Junker <1181362+steveej@users.noreply.github.com>

* Rename latest_holochain_tag -> latest_holochain_release_tag

* Rename latest_holochain_version -> latest_holochain_release_version

---------

Co-authored-by: Stefan Junker <1181362+steveej@users.noreply.github.com>
  • Loading branch information
ThetaSinner and steveej authored Jul 21, 2023
1 parent 71966fe commit fed0d2e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
25 changes: 13 additions & 12 deletions .github/workflows/release-prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ on:
required: true

outputs:
latest_holochain_tag:
latest_holochain_release_tag:
description: "which holochain tag, if one, will be released"
value: ${{ jobs.prepare.outputs.latest_holochain_tag }}
latest_holochain_version:
value: ${{ jobs.prepare.outputs.latest_holochain_release_tag }}
latest_holochain_release_version:
description: "which holochain version, if one, will be released"
value: ${{ jobs.prepare.outputs.latest_holochain_version }}
value: ${{ jobs.prepare.outputs.latest_holochain_release_version }}
release_branch:
description: "the branch that contains the changes made during this action"
value: ${{ jobs.prepare.outputs.release_branch }}
Expand All @@ -79,8 +79,8 @@ jobs:
CACHIX_REV: ${{ inputs.CACHIX_REV }}
runs-on: ubuntu-latest
outputs:
latest_holochain_tag: ${{ steps.write-env-and-tag.outputs.latest_holochain_tag }}
latest_holochain_version: ${{ steps.write-env-and-tag.outputs.latest_holochain_version }}
latest_holochain_release_tag: ${{ steps.write-env-and-tag.outputs.latest_holochain_release_tag }}
latest_holochain_release_version: ${{ steps.write-env-and-tag.outputs.latest_holochain_release_version }}
release_branch: ${{ steps.write-env-and-tag.outputs.release_branch }}
repo_nix_store_path: ${{ steps.write-env-and-tag.outputs.repo_nix_store_path }}
releasable_crates: ${{ steps.bump-versions.outputs.releasable_crates }}
Expand Down Expand Up @@ -259,18 +259,19 @@ jobs:
cd "${HOLOCHAIN_REPO}"
git tag --sort=-taggerdate | grep holochain-
export LATEST_HOLOCHAIN_TAG=$(git tag --sort=-taggerdate | grep holochain- | head -n1)
export LATEST_HOLOCHAIN_VERSION=${LATEST_HOLOCHAIN_TAG/holochain-/}
export RELEASE_BRANCH=$(git branch --show-current)
git tag --sort=-taggerdate --merged "${RELEASE_BRANCH}" | grep holochain-
export LATEST_HOLOCHAIN_RELEASE_TAG=$(git tag --sort=-taggerdate --merged "${RELEASE_BRANCH}" | grep holochain- | head -n1)
export LATEST_HOLOCHAIN_RELEASE_VERSION=${LATEST_HOLOCHAIN_RELEASE_TAG/holochain-/}
# clean the repo before adding it to the store
git clean -ffdx
export STORE_PATH=$(nix store add-path --name holochain_repo .)
echo "latest_holochain_tag=${LATEST_HOLOCHAIN_TAG}" >> $GITHUB_OUTPUT
echo "latest_holochain_version=${LATEST_HOLOCHAIN_VERSION}" >> $GITHUB_OUTPUT
echo "latest_holochain_release_tag=${LATEST_HOLOCHAIN_RELEASE_TAG}" >> $GITHUB_OUTPUT
echo "latest_holochain_release_version=${LATEST_HOLOCHAIN_RELEASE_VERSION}" >> $GITHUB_OUTPUT
echo "release_branch=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT
echo "repo_nix_store_path=${STORE_PATH}" >> $GITHUB_OUTPUT
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOLOCHAIN_TARGET_BRANCH: ${{ needs.vars.outputs.holochain_target_branch }}
RELEASE_BRANCH: ${{ needs.prepare.outputs.release_branch }}
LATEST_HOLOCHAIN_TAG: ${{ needs.prepare.outputs.latest_holochain_tag }}
LATEST_HOLOCHAIN_VERSION: ${{ needs.prepare.outputs.latest_holochain_version }}
LATEST_HOLOCHAIN_RELEASE_TAG: ${{ needs.prepare.outputs.latest_holochain_release_tag }}
LATEST_HOLOCHAIN_RELEASE_VERSION: ${{ needs.prepare.outputs.latest_holochain_release_version }}
DRY_RUN: "${{ needs.vars.outputs.dry_run }}"
run: |
set -eux
Expand Down Expand Up @@ -410,8 +410,8 @@ jobs:
continue-on-error: true
env:
STATUS: ${{ steps.check-status.outcome }}
VERSION: ${{ needs.prepare.outputs.latest_holochain_version }}
TAG: ${{ needs.prepare.outputs.latest_holochain_tag }}
VERSION: ${{ needs.prepare.outputs.latest_holochain_release_version }}
TAG: ${{ needs.prepare.outputs.latest_holochain_release_tag }}
WORKFLOW_RUN_URL: "https://github.com/holochain/holochain/actions/runs/${{ github.run_id }}"
HRA_MATTERMOST_TOKEN: ${{ secrets.HRA_MATTERMOST_TOKEN }}

Expand Down Expand Up @@ -483,8 +483,8 @@ jobs:
continue-on-error: true
env:
STATUS: ${{ steps.check-status.outcome }}
VERSION: ${{ needs.prepare.outputs.latest_holochain_version }}
TAG: ${{ needs.prepare.outputs.latest_holochain_tag }}
VERSION: ${{ needs.prepare.outputs.latest_holochain_release_version }}
TAG: ${{ needs.prepare.outputs.latest_holochain_release_tag }}
WORKFLOW_RUN_URL: "https://github.com/holochain/holochain/actions/runs/${{ github.run_id }}"
HRA_MATTERMOST_TOKEN: ${{ secrets.HRA_MATTERMOST_TOKEN }}
DRY_RUN: "${{ needs.vars.outputs.dry_run }}"
Expand Down
8 changes: 4 additions & 4 deletions scripts/ci-gh-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
set -eux

# a positive condition means the current holochain version has already been released, hence this release doesn't contain holochain
if gh release view "${LATEST_HOLOCHAIN_TAG}"; then
if gh release view "${LATEST_HOLOCHAIN_RELEASE_TAG}"; then
export RELEASE_TAG=${RELEASE_BRANCH}
export IS_HOLOCHAIN_RELEASE="false"
else
export RELEASE_TAG=${LATEST_HOLOCHAIN_TAG}
export RELEASE_TAG=${LATEST_HOLOCHAIN_RELEASE_TAG}
export IS_HOLOCHAIN_RELEASE="true"
fi

Expand All @@ -19,7 +19,7 @@ else
fi

# simply check for the delimeter between the version number and a pre-release suffix
if [[ "${LATEST_HOLOCHAIN_VERSION}" == *"-"* ]]; then
if [[ "${LATEST_HOLOCHAIN_RELEASE_VERSION}" == *"-"* ]]; then
export IS_PRE_RELEASE="true"
else
export IS_PRE_RELEASE="false"
Expand All @@ -32,7 +32,7 @@ cmd=(
-H "Accept: application/vnd.github+json"
-f tag_name="${RELEASE_TAG}"
-f target_commitish="${HOLOCHAIN_TARGET_BRANCH}"
-f name="holochain ${LATEST_HOLOCHAIN_VERSION} (${RELEASE_BRANCH#*-})"
-f name="holochain ${LATEST_HOLOCHAIN_RELEASE_VERSION} (${RELEASE_BRANCH#*-})"
-f body="***Please read [this release's top-level CHANGELOG](https://github.com/holochain/holochain/blob/${HOLOCHAIN_TARGET_BRANCH}/CHANGELOG.md#$(sed -E 's/(release-|\.)//g' <<<"${RELEASE_BRANCH}")) to see the full list of crates that were released together.***" \
-F draft=false
-F generate_release_notes=false
Expand Down

0 comments on commit fed0d2e

Please sign in to comment.