-
-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
155 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
name: Publish PR | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
publish: | ||
name: Publish to Github Packages | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout 🛎️ | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node v14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '14' | ||
|
||
- name: Install 🔧 | ||
uses: bahmutov/npm-install@v1 | ||
|
||
- name: Build | ||
run: yarn run build | ||
|
||
- uses: actions/setup-node@v1 | ||
with: | ||
registry-url: 'https://npm.pkg.github.com' | ||
|
||
- name: Publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
DIST_TAG="pr${{ github.event.number }}" | ||
DIST_VERSION="0.0.0-${DIST_TAG}-${GITHUB_SHA:0:8}" | ||
sed -i -r 's|("name": ")[^"]+(")|\1@${{ github.repository }}\2|;s|("version": ")[^"]+(")|\1@'$DIST_VERSION'\2|' dist/package.json | ||
echo "> **THIS IS THE [PR ${{ github.event.number }}](${{ github.event.pull_request.html_url }}) PREVIEW PACKAGE**" > dist/README.md | ||
echo "" >> dist/README.md | ||
echo "---" >> dist/README.md | ||
echo "" >> dist/README.md | ||
cat README.md >> dist/README.md | ||
npm publish --tag "${DIST_TAG}" --access public dist | ||
- name: Comment | ||
uses: mshick/add-pr-comment@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
repo-token-user-login: 'github-actions[bot]' # The user.login for temporary GitHub tokens | ||
allow-repeats: false # This is the default | ||
message: | | ||
> We publish PR packages to [npm.pkg.github.com](https://github.com/orgs/${{ github.repository_owner }}/packages?repo_name=twind). | ||
> This allows to try new features before they are merged. | ||
> | ||
> Official releases are **only** available on [registry.npmjs.org](https://www.npmjs.com/package/twind) as `twind`. | ||
**Install this PR package** | ||
<details><summary>Configure your NPM client (click to expand)></summary> | ||
Adjust you `.npmrc` to use `https://npm.pkg.github.com` for `@${{ github.repository_owner }}` | ||
``` | ||
@${{ github.repository_owner }}:registry=https://npm.pkg.github.com | ||
``` | ||
Using the command line: | ||
```sh | ||
npm config set @${{ github.repository_owner }}:registry https://npm.pkg.github.com --global | ||
``` | ||
</details> | ||
Install from command line: | ||
```sh | ||
# For npm | ||
npm install twind@npm:@${{ github.repository }}@$pr{{ github.event.number }} | ||
# For yarn | ||
yarn add twind@npm:@${{ github.repository }}@pr${{ github.event.number }} | ||
``` | ||
Install via package.json: | ||
```json | ||
{ | ||
"dependencies": { | ||
"twind": "npm:@${{ github.repository }}@pr${{ github.event.number }}" | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters