Skip to content

Commit

Permalink
chore: add release step 🙏
Browse files Browse the repository at this point in the history
  • Loading branch information
AriTheElk committed Dec 15, 2024
1 parent d68e4b3 commit b26cc85
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Manual Release

on:
workflow_dispatch:
inputs:
version_type:
description: "Version number"
required: true
default: ""

jobs:
release:
runs-on: ubuntu-latest

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v3

# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18 # or whatever version your project requires

# Install dependencies
- name: Install dependencies
run: npm ci

# Run npm version (bump version)
- name: Bump version
id: bump_version
run: |
npm version ${{ github.event.inputs.version_type }}
echo "VERSION=$(node -p \"require('./package.json').version\")" >> $GITHUB_ENV
# Push version bump commit and tag
- name: Push version bump and tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin HEAD --tags
# Run the build process
- name: Build for production
run: npm run build

# Create a new GitHub release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
body: |
## Changes in this release
- TODO: Add release notes here.
draft: false
prerelease: false

# Upload assets to the release
- name: Upload assets to GitHub Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/main.js
asset_name: main.js
asset_content_type: application/javascript

- name: Upload styles.css
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/styles.css
asset_name: styles.css
asset_content_type: text/css

- name: Upload manifest.json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/manifest.json
asset_name: manifest.json
asset_content_type: application/json

0 comments on commit b26cc85

Please sign in to comment.