mirror of
https://github.com/lostpaul/obsidian-folder-notes.git
synced 2026-07-22 07:40:24 +00:00
61 lines
1.9 KiB
YAML
61 lines
1.9 KiB
YAML
# https://github.com/SilentVoid13/Templater/blob/master/.github/workflows/release.yml
|
|
name: Plugin release
|
|
on:
|
|
push:
|
|
tags:
|
|
- "[0-9]+.[0-9]+.[0-9]+"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Fetch all branches
|
|
run: git fetch --all
|
|
|
|
- name: Extract branch name
|
|
id: extract_branch
|
|
run: echo "BRANCH_NAME=$(git branch -r --contains ${GITHUB_SHA} | grep -v 'detached' | sed 's|origin/||' | xargs)" >> $GITHUB_ENV
|
|
|
|
# Checkout the main branch to update manifest.json
|
|
- name: Checkout main branch to update manifest
|
|
run: |
|
|
git checkout main
|
|
git pull origin main
|
|
|
|
- name: Update manifest.json in main branch
|
|
run: |
|
|
VERSION=${GITHUB_REF#refs/tags/}
|
|
jq --arg version "$VERSION" '.version = $version' manifest.json > manifest-temp.json
|
|
mv manifest-temp.json manifest.json
|
|
|
|
- name: Commit and push manifest.json changes in main
|
|
run: |
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
git add manifest.json
|
|
git commit -m "Update manifest.json to version $VERSION"
|
|
git push origin main
|
|
|
|
# Switch back to the branch that triggered the workflow
|
|
- name: Checkout original branch
|
|
run: |
|
|
git checkout ${{ env.BRANCH_NAME }}
|
|
git pull origin ${{ env.BRANCH_NAME }}
|
|
|
|
- name: npm build
|
|
run: |
|
|
npm install
|
|
npm run fn-build --if-present
|
|
|
|
- name: Create Plugin release
|
|
uses: ncipollo/release-action@v1.12.0
|
|
with:
|
|
artifacts: "main.js,manifest.json,styles.css"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
tag: ${{ github.ref_name }}
|