Skip to content

Commit

Permalink
ft(github-release) add auto github release to frontend project. Resol…
Browse files Browse the repository at this point in the history
…ves:#40
  • Loading branch information
MC-Knight committed Jun 26, 2024
1 parent 911c279 commit ec052e3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
52 changes: 51 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: knights-ecomm-fe CI

on:
on:
push:
pull_request:

Expand Down Expand Up @@ -38,3 +38,53 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

release:
if: github.ref == 'refs/heads/ft-release-config'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'

- name: Install Dependencies
run: npm install

- name: Build project
run: npm run build

- name: Bump Version
id: bump_version
run: |
NEW_VERSION=$(npm version minor --no-git-tag-version)
echo "New version is $NEW_VERSION"
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Zip dist folder
run: zip -r dist.zip ./dist

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.NEW_VERSION }}
release_name: Release ${{ env.NEW_VERSION }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist
asset_name: dist.zip
asset_content_type: application/zip
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "knights-ecomm-fe",
"private": true,
"version": "0.0.0",
"version": "1.0.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down

0 comments on commit ec052e3

Please sign in to comment.