Skip to content

Commit 8c3f92b

Browse files
committed
chore: add github actions for ci and release
1 parent 27d25ae commit 8c3f92b

2 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
build:
11+
name: Build check
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "20"
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Minify CSS
27+
run: npm run build
28+
29+
- name: Check output exists
30+
run: test -f gallo.min.css && echo "✅ gallo.min.css generated successfully"

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Build, release & publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20"
24+
registry-url: "https://registry.npmjs.org"
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Minify CSS
30+
run: npm run build
31+
32+
- name: Get version from tag
33+
id: version
34+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
35+
36+
- name: Bump package.json version
37+
run: npm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version
38+
39+
- name: Create GitHub Release
40+
uses: softprops/action-gh-release@v2
41+
with:
42+
name: "Gallo ${{ github.ref_name }}"
43+
body: |
44+
## Gallo ${{ github.ref_name }}
45+
46+
### Install
47+
```html
48+
<!-- CDN -->
49+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gallocss/gallo@${{ steps.version.outputs.VERSION }}/gallo.min.css">
50+
```
51+
```bash
52+
# npm
53+
npm install @gallocss/gallo
54+
```
55+
56+
### Changelog
57+
See [commits since last release](https://github.com/${{ github.repository }}/commits/${{ github.ref_name }}).
58+
files: |
59+
gallo.css
60+
gallo.min.css
61+
draft: false
62+
prerelease: false
63+
64+
- name: Publish to npm
65+
run: npm publish --access public
66+
env:
67+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)