Skip to content

Commit

Permalink
add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-zhao committed Apr 2, 2024
1 parent 5636e41 commit acbd1d6
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x

- name: Install dependencies
run: npm install

- name: Build project
run: npm run build
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16.x

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Package build files
run: |
mkdir -p dist
zip -r dist/build-${{ github.sha }}.zip dist
- name: Get package version
id: get_version
run: echo "::set-output name=version::$(npm show <package-name> version)"

- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Package version: ${{ steps.get_version.outputs.version }}
draft: false
prerelease: false

- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
name: build-artifact
path: dist/build-${{ github.sha }}.zip

0 comments on commit acbd1d6

Please sign in to comment.