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

🚧 Make publishing packages on GitHub working #1684

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
38 changes: 33 additions & 5 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
name: Publish
name: 🚢 Publish

on:
push:
branches:
- main
tags:
- '**'
- release/next
- release/alpha
- release/beta

jobs:
hasTag:
name: 🏷️ Analyze Tags
runs-on: ubuntu-24.04

outputs:
hasTag: ${{ steps.checkTagExists.outputs.has-tag }}

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-tags: true

# ⚠️ This check works only if the tag is pushed alongside the commit
# Please, use `git push && git push --tags` or `git push --follow-tags` (works only for annonated tags)
- name: Check Tag On Commit
id: checkTagExists
run: |
if [ -n "$(git tag --points-at HEAD)" ]; then
echo "has-tag=true" >> $GITHUB_OUTPUT
else
echo "has-tag=false" >> $GITHUB_OUTPUT
fi

publish:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
name: Publish package
name: 📦 Publish Packages
needs: hasTag
if: ${{ needs.hasTag.outputs.hasTag == 'true' }}
runs-on: ubuntu-24.04

steps:
- name: Clone repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -39,4 +66,5 @@ jobs:
- name: Publish
run: make publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
15 changes: 12 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,23 @@ For more, please read the article [How to Run GitHub Actions Locally with the ac

## Publishing

This project uses GitHub Actions to publish the packages automatically to npm. New packages are published after the new tag is pushed to the main branch. PR can be merged only by the appropriate group of maintainers.
This project uses GitHub Actions to publish the packages automatically to npm.
New packages are published after the new tag is pushed to the main branch.
PR can be merged only by the appropriate group of maintainers.

### Steps to Create a New Package Version

1. Merge all appropriate PRs you want to publish into the main branch
1. Merge all appropriate PRs you want to publish into the appropriate branch
- branches:
- `main` - for the latest stable version
- `next` - for the canary version
- `alpha` - for the alpha version
- `beta` - for the beta version
2. Run the `make version` command to bump the version number in packages (a new version number is determined automatically based on commit history)
3. Check that the version number is correct and everything looks good
4. Run manually `git push && git push --tags` to push the changes to the remote
4. Push changes and tags to repository
4a. Run manually `git push && git push --tags` to push the changes to the remote
4b. or use `git push --follow-tags` to push the changes and tags at once (works only when tags are annotated).
5. Publishing is done automatically by GitHub Actions (uses `build` script and `make publish` command)

> If you have further questions do not hesitate to open an issue and ask us! ❤️
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ version: ## Create new version of packages
# @see https://github.com/lerna/lerna/tree/main/commands/version#readme
# Bump version of packages changed since the last release
# --yes` - skip all confirmation prompts
$(PKG_MANAGER) $(MONOREPO_TOOL) version --yes --no-push $(MONOREPO_TOOL_FLAGS) $(MONOREPO_TOOL_NO_PUSH)
$(PKG_MANAGER) $(MONOREPO_TOOL) version --create-release github --yes --no-push $(MONOREPO_TOOL_FLAGS) $(MONOREPO_TOOL_NO_PUSH)

build: ## Builds all packages
$(PKG_MANAGER) build
Expand Down
Loading