Skip to content

Commit

Permalink
Update publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wns3645 committed Aug 4, 2024
1 parent 52557c2 commit 279607a
Showing 1 changed file with 37 additions and 10 deletions.
47 changes: 37 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Build Logseq Plugin
name: Build plugin

on:
push:
branches:
- "main"
workflow_dispatch:

# Sequence of patterns matched against refs/tags
tags:
- "*" # Push events to matching any tag format, i.e. 1.0, 20.15.10
env:
PLUGIN_NAME: ${{ github.event.repository.name }}

Expand All @@ -19,20 +18,48 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "20.x" # You might need to adjust this value to your own version
node-version: "20"

- name: Build
id: build
run: |
npm ci && npm run build
mkdir ${{ env.PLUGIN_NAME }}
cp README.md package.json icon.svg ${{ env.PLUGIN_NAME }}
cp README.md package.json icon.png ${{ env.PLUGIN_NAME }}
mv dist ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
ls
echo "tag_name=git tag --sort version:refname | tail -n 1" >> $GITHUB_OUTPUT
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
- name: Create Release
uses: ncipollo/release-action@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref }}
with:
allowUpdates: true
draft: false
prerelease: false

- name: Release
run: npx semantic-release
- name: Upload zip file
id: upload_zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.PLUGIN_NAME }}.zip
asset_name: ${{ env.PLUGIN_NAME }}-${{ steps.build.outputs.tag_name }}.zip
asset_content_type: application/zip

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

0 comments on commit 279607a

Please sign in to comment.