Skip to content

Commit 3555228

Browse files
authored
Add GitHub Actions workflow for release process
1 parent 353d0e9 commit 3555228

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build & Draft Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
actions: write
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v6
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 20
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Build project
30+
run: npm run build
31+
32+
- name: Minify CSS
33+
run: npx clean-css-cli -o dist/zyroxcss.min.css dist/zyroxcss.css
34+
35+
- name: Generate SHA512
36+
id: hash
37+
run: |
38+
sha512sum dist/zyroxcss.min.css | awk '{ print $1 }' > dist/zyroxcss.min.css.sha512
39+
HASH=$(cat dist/zyroxcss.min.css.sha512)
40+
echo "sha512=$HASH" >> $GITHUB_ENV
41+
42+
- name: Create Draft Release
43+
id: create_release
44+
uses: softprops/action-gh-release@v2
45+
with:
46+
tag_name: ${{ github.ref_name }}
47+
name: ${{ github.ref_name }}
48+
draft: true
49+
body: |
50+
**Release Date:** ${{ github.event.pushed_at }}
51+
**Status:** Stable
52+
**Type:** Minor Update
53+
54+
## Changelog
55+
Full details can be found [here](changelogs/${{ github.ref_name }}.md).
56+
57+
## Installation
58+
### CDN
59+
```html
60+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/zyroxcssv2@${{ github.ref_name }}/dist/css/zyroxcss.min.css" integrity="sha512-${{ env.sha512 }}" crossorigin="anonymous" referrerpolicy="no-referrer" />
61+
<link rel="stylesheet" href="https://unpkg.com/zyroxcssv2@${{ github.ref_name }}/dist/css/zyroxcss.min.css" integrity="sha512-${{ env.sha512 }}" crossorigin="anonymous" referrerpolicy="no-referrer" />
62+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/zyroxcssv2/${{ github.ref_name }}/zyroxcss.min.css" integrity="sha512-${{ env.sha512 }}" crossorigin="anonymous" referrerpolicy="no-referrer" />
63+
```
64+
### npm
65+
```bash
66+
npm install zyroxcssv2
67+
```
68+
```js
69+
import 'zyroxcssv2/dist/css/zyroxcss.min.css';
70+
```
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
74+
- name: Upload Minified CSS to Release
75+
uses: actions/upload-release-asset@v1
76+
with:
77+
upload_url: ${{ steps.create_release.outputs.upload_url }}
78+
asset_path: ./dist/zyroxcss.min.css
79+
asset_name: zyroxcss.min.css
80+
asset_content_type: text/css

0 commit comments

Comments
 (0)