Release Obsidian Plugin #13
Workflow file for this run
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
name: Release Obsidian Plugin | |
on: | |
push: | |
# Sequence of patterns matched against refs/tags | |
tags: | |
- "*" # Push events to matching any tag format, i.e. 1.0, 20.15.10 | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "16.x" # You might need to adjust this value to your own version | |
# Build the plugin | |
- name: Build | |
run: | | |
yarn | |
yarn run build | |
# Get the version number and put it in a variable | |
- name: Get version info | |
id: version | |
run: | | |
echo "name=$(git describe --abbrev=0 --tags)" >> $GITHUB_OUTPUT | |
# Package the required files into a zip | |
- name: Package plugin archive | |
run: | | |
mkdir ${{ github.event.repository.name }} | |
cp main.js manifest.json README.md ${{ github.event.repository.name }} | |
zip -r ${{ github.event.repository.name }}-${{ steps.version.outputs.name }}.zip ${{ github.event.repository.name }} | |
# Create the release on github | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
files: | | |
${{ github.event.repository.name }}-${{ steps.version.outputs.name }}.zip | |
main.js | |
manifest.json | |
name: ${{ steps.version.outputs.name }} | |
prerelease: false | |
tag_name: ${{ github.ref }} | |
token: ${{ secrets.GITHUB_TOKEN }} |