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

feat: add automated release #7

Merged
merged 4 commits into from
Sep 12, 2023
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
10 changes: 10 additions & 0 deletions .github/workflows/pr-title-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: PR Title Linter
on:
pull_request:
types: [opened, edited, reopened, synchronize]
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Validate title
uses: warp-ds/pr-linter@v1
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release
on:
push:
branches:
- main
- alpha
- beta
- next
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install pnpm and dependencies
uses: pnpm/action-setup@v2
with:
version: 8
run_install: true
- name: Build
run: pnpm build:release
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: Eik login and publish
run: pnpm eik login -k $EIK_TOKEN && pnpm eik publish || true
env:
EIK_TOKEN: ${{ secrets.EIK_TOKEN }}
20 changes: 20 additions & 0 deletions .github/workflows/update-alpha.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Update alpha
on:
workflow_run:
workflows:
- Release
branches:
- alpha
types: completed
jobs:
rebase:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Rebase alpha to main
run: |
git fetch --unshallow
git checkout alpha
git rebase origin/main
git push
16 changes: 16 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"branches": [
{ "name": "main" },
{ "name": "alpha", "prerelease": true },
{ "name": "beta", "prerelease": true },
{ "name": "next", "prerelease": true }
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
["@semantic-release/npm", { "tarballDir": "release" }],
["@semantic-release/github", { "assets": "release/*.tgz" }],
"@semantic-release/git"
]
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2023 Schibsted

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
93 changes: 91 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,84 @@
# WARP icons
The icon set for WARP, imported from (Figma project)[!https://www.figma.com/file/yEx16ew6S0Xgd579dN4hsM/Warp---Icons?type=design&node-id=150-113&mode=design&t=TRtIuPlsDoYlbuqd-0].

**Note that the icons in the "src/raw" folder in this repository should never be used directly, as they aren't optimized.**

## How to use

### React

#### Install dependencies

```sh
npm install @warp-ds/icons
```

#### Import React icons

```jsx
import { IconBag16 } from '@warp-ds/icons/react';
```

```jsx
<IconBag16 />
```

### Vue

#### Install dependencies

```sh
npm install @warp-ds/icons
```

#### Import Vue icons

```js
import { IconChevronRight16 } from '@warp-ds/icons/vue';
```

```js
<icon-chevron-right16 />
```

### Elements

#### Install dependencies

You will need to install both Warp Elements and Lit Element which is the library we use for custom elements

```sh
npm install lit @warp-ds/icons
```

#### Import elements

Import the individual element file, importing will load the component.
Once imported, run your script through whatever bundling process your app uses (Rollup, Esbuild, etc) after which the component can be used in the page.

```js
import '@warp-ds/icons/elements/attachment-16';
import '@warp-ds/icons/elements/attachment-24';
```

```html
<w-icon-attachment16></w-icon-attachment16>
<w-icon-attachment24></w-icon-attachment24>
```


## Development

### Updating the icons
Icons should never be added or edited manually in this repository, as the source of truth is in (Figma)[!https://www.figma.com/file/yEx16ew6S0Xgd579dN4hsM/Warp---Icons?type=design&node-id=150-113&mode=design&t=TRtIuPlsDoYlbuqd-0].
Icons should never be added or edited manually in this repository, as the source of truth is in [Figma](https://www.figma.com/file/yEx16ew6S0Xgd579dN4hsM/Warp---Icons?type=design&node-id=150-113&mode=design&t=TRtIuPlsDoYlbuqd-0).

#### Figma access token
If you are running the import script for the first time, it will prompt your for a Figma access token. The token is is required to access Figma's API. It can be generated on your Figma account settings page.

The import script may store the token to a local file, so you won't have to supply the token again on subsequent runs.

### Import script
To update the icons, run the following script. If it has a valid Figma access token (see above), it will proceed to download all the icons as SVG files.
To update the icons, run the following script. If it has a valid Figma access token ([see previous section](#figma-access-token)), it will proceed to download all the icons as SVG files.

```bash
./scripts/import.js
Expand All @@ -32,3 +98,26 @@ pnpm dev
```


## Releases

This project is continuously published to [NPM](https://www.npmjs.com/package/@warp-ds/icons) and [Eik](https://assets.finn.no/pkg/@warp-ds/icons) using an `alpha` tag (e.g. `1.1.0-alpha.1`).
Anyone needing to use the latest changes of this package can point to the `alpha` version while waiting for the stable release.

Eik versions for each of Vue, Elements and React icons that are built to the ./dist folder are automatically published to Eik under the path `https://assets.finn.no/pkg/{name}/{version}/`.

Example Paths:
* React: `https://assets.finn.no/pkg/@warp-ds/icons/v1/react/icons.min.js`
* Vue: `https://assets.finn.no/pkg/@warp-ds/icons/v1/vue/icons.min.js`
* Custom Elements: `https://assets.finn.no/pkg/@warp-ds/icons/v1/elements/icons.min.js`
* Raw ads svg at size 16: `https://assets.finn.no/pkg/@warp-ds/icons/v1/16/ads.svg`
* Raw air con svg at size 24: `https://assets.finn.no/pkg/@warp-ds/icons/v1/24/air-con.svg`


## Changelog

Detailed changes for each release can be found in the [CHANGELOG](CHANGELOG.md) file.


## License

@warp-ds/icons is available under the [Apache-2.0 software license](https://github.com/warp-ds/react/blob/main/LICENSE).
13 changes: 13 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@warp-ds/icons",
"type": "module",
"version": "0.0.1",
"repository": "git@github.com:warp-ds/icons.git",
"description": "WARP's icon set",
"main": "index.js",
"files": [
Expand All @@ -19,20 +20,26 @@
"./package.json": "./package.json"
},
"scripts": {
"commit": "cz",
"import": "node ./scripts/import.js",
"build": "node ./scripts/build.js",
"dev": "pnpm build && vite",
"build:release": "rimraf dist && pnpm build && pnpm build:vue && pnpm build:react && pnpm build:elements",
"build:react": "rimraf react && mkdir react && node ./scripts/output/react.js && node ./react.eik.js",
"build:vue": "rimraf vue && mkdir vue && node ./scripts/output/vue.js && node ./vue.eik.js",
"build:elements": "rimraf elements && mkdir elements && node ./scripts/output/elements.js && node ./elements.eik.js"
},
"license": "Apache-2.0",
"devDependencies": {
"@eik/cli": "^2.0.22",
"@eik/esbuild-plugin": "^1.1.11",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@sindresorhus/slugify": "^2.1.0",
"@warp-ds/uno": "^1.0.0",
"camelcase": "^8.0.0",
"chalk": "^5.0.1",
"cz-conventional-changelog": "^3.3.0",
"esbuild": "^0.14.42",
"fs-extra": "^11.1.1",
"glob": "^10.0.0",
Expand All @@ -43,6 +50,7 @@
"ora": "^7.0.1",
"prompts": "^2.4.0",
"rimraf": "^5.0.1",
"semantic-release": "^21.1.1",
"svgo": "^3.0.0",
"unocss": "^0.55.2",
"vite": "^4.4.9",
Expand All @@ -64,5 +72,10 @@
"https://assets.finn.no/map/vue/v1",
"https://assets.finn.no/map/custom-elements/v2"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Loading