Skip to content

Commit

Permalink
package: add release action
Browse files Browse the repository at this point in the history
  • Loading branch information
exqt committed Mar 19, 2024
1 parent 706e08a commit 13d2d77
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
56 changes: 56 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# .github/workflows/release.yml
name: Release

on:
push:
tags:
- '*'

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: '14'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Get version
id: pkg
run: echo "::set-output name=version::$(npm run -s version)"

- name: Archive distribution files
run: |
zip -r ${{ steps.pkg.outputs.version }}.zip dist/
- name: Create 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 }}
draft: false
prerelease: false

- name: Upload Release Asset
id: 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: ./${{ steps.pkg.outputs.version }}.zip
asset_name: ${{ steps.pkg.outputs.version }}.zip
asset_content_type: application/zip
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
"build-storybook": "storybook build",
"version": "node -p \"require('./package.json').version\""
},
"devDependencies": {
"@crxjs/vite-plugin": "^2.0.0-beta.21",
Expand Down

0 comments on commit 13d2d77

Please sign in to comment.