Skip to content
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
97 changes: 97 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Publish Package

on:
pull_request:
types: [closed]
branches:
- master

permissions:
contents: write

jobs:
test-and-build:
name: Test and build
uses: ./.github/workflows/test-and-build.yml

publish:
# if: github.event.pull_request.merged == true && (contains(github.event.pull_request.labels.*.name, 'release:major') || contains(github.event.pull_request.labels.*.name, 'release:minor') || contains(github.event.pull_request.labels.*.name, 'release:patch'))
if: contains(github.event.pull_request.labels.*.name, 'release:major') || contains(github.event.pull_request.labels.*.name, 'release:minor') || contains(github.event.pull_request.labels.*.name, 'release:patch')
needs: test-and-build
runs-on: ubuntu-latest
steps:
- name: Determine version type from label
id: version-type
run: |
LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}'
if echo $LABELS | grep -a "release:major"; then
VERSION_TYPE="major"
elif echo $LABELS | grep -a "release:minor"; then
VERSION_TYPE="minor"
elif echo $LABELS | grep -a "release:patch"; then
VERSION_TYPE="patch"
else
echo "::error::No valid release label found (release:major, release:minor, release:patch)."
exit 1
fi
echo "type=$VERSION_TYPE" >> $GITHUB_OUTPUT
echo "Running a $VERSION_TYPE release"

- name: Configure git access
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.JAM_GIT_PUSHER_APP_ID }}
private-key: ${{ secrets.JAM_GIT_PUSHER_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v3
with:
ref: "master"
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18.19"
registry-url: "https://registry.npmjs.org"

- name: Configure git author
run: |
git config user.name GitHub Actions
git config user.email github-actions@github.com

- name: Install dependencies
run: npm ci

- name: Tag release
id: bump-version
run: |
npm version "${{ steps.version-type.outputs.type }}"
echo "new_version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT

# Run this after the version bump! So that the version is correct in the release
- name: Build
run: npm run build

# Run this after the build! So we only push tags if the build is successful
- name: Push tags
run: git push --tags origin HEAD
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create a GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.bump-version.outputs.new_version }}
release_name: v${{ steps.bump-version.outputs.new_version }}
draft: false
prerelease: false

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5 changes: 4 additions & 1 deletion .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Test and build when pushing to a branch
on: push
on:
push:
workflow_call:

jobs:
test_and_build:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
[npm-image]: https://badge.fury.io/js/rimless.svg
[commitizen-url]: http://commitizen.github.io/cz-cli/
[commitizen-image]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
[license-url]: https://github.com/au-re/rimless/LICENSE
[license-url]: https://github.com/jamdotdev/rimless/LICENSE

<p align="center">
<img src="https://raw.githubusercontent.com/au-re/rimless/master/assets/icon.png"/>
<img src="https://raw.githubusercontent.com/jamdotdev/rimless/master/assets/icon.png"/>
</p>

# rimless
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
{
"name": "rimless",
"name": "@jam.dev/rimless",
"author": "Aurélien Franky",
"version": "0.4.0",
"license": "MIT",
"homepage": "https://github.com/au-re/rimless",
"homepage": "https://github.com/jamdotdev/rimless",
"description": "event base communication made easy with a promise-based API wrapping `postMessage`",
"type": "module",
"main": "lib/rimless.js",
"module": "lib/rimless.js",
"types": "lib/index.d.ts",
"files": ["lib"],
"files": [
"lib"
],
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
Expand All @@ -22,7 +24,10 @@
},
"repository": {
"type": "git",
"url": "https://github.com/au-re/rimless.git"
"url": "git+https://github.com/jamdotdev/rimless.git"
},
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.7.0",
Expand Down
Loading