mirror of
https://github.com/exoticknight/quick-nav.git
synced 2026-07-22 05:37:37 +00:00
chore: auto release
This commit is contained in:
parent
be3a89b3fb
commit
72f04294d4
1 changed files with 66 additions and 0 deletions
66
.github/workflow/release.yaml
vendored
Normal file
66
.github/workflow/release.yaml
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
# modified from https://github.com/Ebonsignori/obsidian-auto-journal/blob/main/.github/workflows/release.yml
|
||||
# Creates a new GitHub Release when a tag is pushed
|
||||
name: Release
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "[0-9]+.[0-9]+.[0-9]+"
|
||||
|
||||
env:
|
||||
PLUGIN_NAME: quick-nav
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check out Git repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Build and zip
|
||||
id: build
|
||||
run: |
|
||||
tag=${GITHUB_REF#refs/*/}
|
||||
# Set tag as output for following steps
|
||||
echo "tag=$tag" >> $GITHUB_OUTPUT
|
||||
|
||||
# Update version in manifest.json and package.json
|
||||
jq --arg tag "$tag" '.version = $tag' manifest.json >> tmp.$$.json && mv tmp.$$.json manifest.json
|
||||
jq --arg tag "$tag" '.version = $tag' package.json >> tmp.$$.json && mv tmp.$$.json package.json
|
||||
|
||||
# Build and zip release
|
||||
npm install
|
||||
npm run build
|
||||
mkdir ${{ env.PLUGIN_NAME }}
|
||||
cp main.js manifest.json ${{ env.PLUGIN_NAME }}
|
||||
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
|
||||
|
||||
- name: Commit version changes
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
default_author: github_actor
|
||||
add: "manifest.json package.json package-lock.json"
|
||||
message: "Release v${{ steps.build.outputs.tag }}"
|
||||
push: "origin HEAD:${{ github.event.repository.default_branch }} --force"
|
||||
# Override existing tag with new tag that has version bump
|
||||
tag: "${{ steps.build.outputs.tag }} --force"
|
||||
tag_push: "--force"
|
||||
|
||||
- name: Release with files
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: ${{ steps.build.outputs.tag }}
|
||||
body: "*Release of ${{ env.PLUGIN_NAME }} v${{ steps.build.outputs.tag }} auto-created by [release.yml](.github/workflows/release.yml)*"
|
||||
files: |
|
||||
${{ env.PLUGIN_NAME }}.zip
|
||||
main.js
|
||||
manifest.json
|
||||
Loading…
Reference in a new issue