Skip to content
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

chore(ci): clean up release and promote workflows #10349

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/promote.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
# Update their versions and changelogs according to angular commit guidelines
# https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit

# if [[ ! -z "${CORE_VERSION}" ]]; then
# echo "Updating to @patternfly/patternfly: ${CORE_VERSION}"
# npm pkg set dependencies.@patternfly/patternfly=${CORE_VERSION} --workspace @patternfly/react-docs
# npm pkg set devDependencies.@patternfly/patternfly=${CORE_VERSION} --workspace @patternfly/react-core --workspace @patternfly/react-styles --workspace @patternfly/react-tokens --workspace @patternfly/react-icons
# if [[ ! -z "${PATTERNFLY_VERSION}" ]]; then
# echo "Updating to @patternfly/patternfly: ${PATTERNFLY_VERSION}"
# npm pkg set dependencies.@patternfly/patternfly=${PATTERNFLY_VERSION} --workspace @patternfly/react-docs
# npm pkg set devDependencies.@patternfly/patternfly=${PATTERNFLY_VERSION} --workspace @patternfly/react-core --workspace @patternfly/react-styles --workspace @patternfly/react-tokens --workspace @patternfly/react-icons
# fi

# publish to npm
Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
name: promote
name: Promote
on:
workflow_dispatch:
inputs:
core-version:
description: The PatternFly core version
patternfly-version:
description: The version of PatternFly (`@patternfly/patternfly`) to promote to.
required: false
jobs:
deploy:
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
CORE_VERSION: ${{ github.event.inputs.core-version }}
RELEASE_VERSION: ${{ github.event.inputs.version }}
GH_TOKEN: ${{ secrets.GH_TOKEN_REDALLEN }}
steps:
- name: Check out project
uses: actions/checkout@v4
with:
# Needs to be an admin token to get around branch protection.
# Pass in an administrator token to get around branch protection.
token: ${{ secrets.GH_TOKEN_REDALLEN }}

- name: Set up and build project
Expand All @@ -27,3 +22,6 @@ jobs:

- name: Deploy to NPM and Github
run: .github/promote.sh
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PATTERNFLY_VERSION: ${{ github.event.inputs.patternfly-version }}
15 changes: 5 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,22 @@ jobs:
name: Deploy release
runs-on: ubuntu-latest
needs: [ci, docs]
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# Needs to be an admin token to get around branch protection.
GH_TOKEN: ${{ secrets.GH_TOKEN_REDALLEN }}
GH_PR_TOKEN: ${{ secrets.GH_PR_TOKEN }}
steps:
- name: Check out project
uses: actions/checkout@v4
with:
# Fetch all history for all branches and tags, which is needed for the release script.
fetch-depth: 0
# Needs to be an admin token to get around branch protection.
# Pass in an administrator token to get around branch protection.
token: ${{ secrets.GH_TOKEN_REDALLEN }}

# Fetches all tags from 'origin' and updates local tags, only fetches the latest commit.
- name: Fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*

Comment on lines -33 to -36
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've remove this as fetch-depth: 0 already fetches all the tags, see actions/checkout#217 (comment).

Copy link
Contributor

@nicolethoen nicolethoen May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetch depth 1 was added (i believe) to make sure we weren't republishing EVERY package in the monorepo each time a single change went into one package. It only republished the relevant packages. I guess we can watch to make sure this doesnt undo that effort now that it's removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So from what I understand Lerna should take care of this for us, but I can see this issue happening if Lerna does not detect any tags. That perhaps happened before if the fetch-depth wasn't set in the action, in which case the default is 1, which would only fetch the latest commit, and perhaps not all the tags.

The Lerna docs link to an Nx example that seem to operate on the same premise. From what I can gather from community blog posts it seems that fetch-depth: 1 should be enough for Lerna to do the right thing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since fetch-depth has 1 as a default value, this should be okay. let's just keep an eye on it.

- name: Set up and build project
uses: ./.github/actions/setup-project
with:
skip-build-cache: true

- name: Deploy to NPM and Github
run: .github/release.sh
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_PR_TOKEN: ${{ secrets.GH_PR_TOKEN }}
Loading