Skip to content

Commit

Permalink
add beta deploy job
Browse files Browse the repository at this point in the history
  • Loading branch information
uphy committed Feb 3, 2024
1 parent aab7e4a commit d786a5f
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 47 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/publish-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build plugin

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "*.*.*-beta*"

env:
PLUGIN_NAME: obsidian-reminder

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
ref: develop
- name: Check if the tag commit is equal to the latest commit
run: |
if [ "$(git rev-parse ${{ github.ref }})" != "$(git rev-parse develop)" ]; then
echo "Tag commit is not equal to the latest commit"
exit 1
fi
- name: Update the versions
run: |
version=$(git tag --sort version:refname | tail -n 1)
echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
# update manifest version
sed -i "s/\"version\": \".*\"/\"version\": \"$version\"/" manifest-beta.json
# commit and push the changes
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add manifest-beta.json
git commit -m "Update the version to $version"
git push develop
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: "16.x" # You might need to adjust this value to your own version
- name: Build
id: build
run: |
npm ci
npm run build
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: ${{ env.RELEASE_VERSION }}
draft: true
prerelease: false
files: |
${{ env.PLUGIN_NAME }}.zip
main.js
manifest.json
styles.css
61 changes: 14 additions & 47 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
# Sequence of patterns matched against refs/tags
tags:
- "*.*.*" # Push events to matching any tag format, i.e. 1.0, 20.15.10
- "!*.*.*-beta*"

env:
PLUGIN_NAME: obsidian-reminder
Expand All @@ -15,6 +16,12 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Check if the tag commit is contained in master branch
run: |
if ! git merge-base --is-ancestor ${{ github.ref }} master; then
echo "Tag commit is not contained in master branch"
exit 1
fi
- name: Use Node.js
uses: actions/setup-node@v1
with:
Expand All @@ -27,55 +34,15 @@ jobs:
mkdir ${{ env.PLUGIN_NAME }}
cp main.js manifest.json styles.css ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
name: ${{ env.RELEASE_VERSION }}
draft: false
prerelease: false
- 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 main.js
id: upload-main
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./main.js
asset_name: main.js
asset_content_type: text/javascript
- name: Upload manifest.json
id: upload-manifest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./manifest.json
asset_name: manifest.json
asset_content_type: application/json
- name: Upload styles.css
id: upload-style
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./styles.css
asset_name: styles.css
asset_content_type: text/css
files: |
${{ env.PLUGIN_NAME }}.zip
main.js
manifest.json
styles.css
10 changes: 10 additions & 0 deletions manifest-beta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"id": "obsidian-reminder-plugin",
"name": "Reminder",
"version": "1.1.15",
"minAppVersion": "1.0.3",
"description": "Reminder plugin for Obsidian. This plugin adds feature to manage TODOs with reminder.",
"author": "uphy",
"authorUrl": "https://obsidian.md/about",
"isDesktopOnly": false
}

0 comments on commit d786a5f

Please sign in to comment.