Skip to content

Commit ec052e3

Browse files
committed
ft(github-release) add auto github release to frontend project. Resolves:#40
1 parent 911c279 commit ec052e3

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: knights-ecomm-fe CI
22

3-
on:
3+
on:
44
push:
55
pull_request:
66

@@ -38,3 +38,53 @@ jobs:
3838
with:
3939
github-token: ${{ secrets.GITHUB_TOKEN }}
4040

41+
release:
42+
if: github.ref == 'refs/heads/ft-release-config'
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Use Node.js
51+
uses: actions/setup-node@v4
52+
with:
53+
node-version: '20.x'
54+
55+
- name: Install Dependencies
56+
run: npm install
57+
58+
- name: Build project
59+
run: npm run build
60+
61+
- name: Bump Version
62+
id: bump_version
63+
run: |
64+
NEW_VERSION=$(npm version minor --no-git-tag-version)
65+
echo "New version is $NEW_VERSION"
66+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
67+
68+
- name: Zip dist folder
69+
run: zip -r dist.zip ./dist
70+
71+
- name: Create Release
72+
id: create_release
73+
uses: actions/create-release@v1
74+
env:
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
with:
77+
tag_name: ${{ env.NEW_VERSION }}
78+
release_name: Release ${{ env.NEW_VERSION }}
79+
draft: false
80+
prerelease: false
81+
82+
- name: Upload Release Asset
83+
uses: actions/upload-release-asset@v1
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
86+
with:
87+
upload_url: ${{ steps.create_release.outputs.upload_url }}
88+
asset_path: ./dist
89+
asset_name: dist.zip
90+
asset_content_type: application/zip

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "knights-ecomm-fe",
33
"private": true,
4-
"version": "0.0.0",
4+
"version": "1.0.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

0 commit comments

Comments
 (0)