Skip to content

Commit

Permalink
Add ability to release dev tag (#773)
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofzuraw authored Mar 15, 2024
1 parent e313509 commit 5bd6ab2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/dev-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release @dev tag to npm
on:
pull_request:
types: [labeled]

jobs:
release:
if: ${{ github.event.label.name == 'release dev tag' }}
runs-on: ubuntu-22.04
env:
HUSKY: 0
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PNPM
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
with:
run_install: |
- args: [--frozen-lockfile]
- name: Check for changeset
run: pnpm exec changeset status --since origin/main
- name: Create .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Release on @dev tag in npm
run: pnpm publish:ci-dev
- name: Get new package version
run: |
VERSION=$(cat package.json | jq -r '.version')
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
- name: Add installation instructions PR comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
env:
VERSION: ${{ env.VERSION }}
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
Released snapshot build with `@dev` tag in npm with version: `${{ env.VERSION }}`.
Install it with:
```shell
pnpm add @saleor/macaw-ui@${{ env.VERSION }}
```
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
with:
title: Release to npm
commit: Release to npm
publish: "pnpm publish:ci"
publish: "pnpm publish:ci-prod"
env:
# Use private access token so Github can trigger another workflow from this one
GITHUB_TOKEN: ${{ secrets.PAT }}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
"test": "vitest",
"dev": "storybook dev -p 6006",
"dev:docs": "storybook dev -p 6006 --docs",
"publish:ci": "pnpm publish && pnpm exec changeset tag && git push --follow-tags",
"publish:ci-prod": "pnpm publish && pnpm exec changeset tag && git push --follow-tags",
"publish:ci-dev": "pnpm exec changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks",
"prepare": "is-ci || husky install",
"chromatic": "chromatic --exit-zero-on-changes"
},
Expand Down

0 comments on commit 5bd6ab2

Please sign in to comment.