Skip to content

Commit

Permalink
ci: add GitHub Actions workflow for build and release
Browse files Browse the repository at this point in the history
  • Loading branch information
holmityd committed Jun 13, 2024
1 parent c853723 commit 9ba68eb
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Release

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

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

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

- name: Install dependencies
run: npm install

- name: Build project
run: npm run build

- name: Prepare release artifacts
run: |
mkdir -p dist/release
mv dist/bundle.js dist/release/bundle.js
cp .env.example dist/release/.env
cd dist
tar -czvf release.tar.gz release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
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/release.tar.gz
asset_name: release.tar.gz
asset_content_type: application/gzip

0 comments on commit 9ba68eb

Please sign in to comment.