generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |