Skip to content

Commit

Permalink
Fixes. Release workflow updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xezard committed Nov 3, 2024
1 parent 6ca5a0f commit 38863b1
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 8 deletions.
60 changes: 58 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release plugin
name: Release

on:
push:
Expand All @@ -9,11 +9,66 @@ env:
PLUGIN_NAME: oencrypt

jobs:
update_version:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Update versions.json
run: |
TAG_NAME=${{ github.ref }}
TAG_NAME=${TAG_NAME#refs/tags/}
if ! grep -q "\"$TAG_NAME\":" versions.json; then
LAST_VERSION=$(jq 'keys | .[-1]' versions.json)
jq --arg tag "$TAG_NAME" --arg last "$LAST_VERSION" '.[$tag] = $last' versions.json > tmp.json && mv tmp.json versions.json
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add versions.json
git commit -m "Update versions.json for $TAG_NAME"
fi
- name: Update package.json
run: |
TAG_NAME=${{ github.ref }}
TAG_NAME=${TAG_NAME#refs/tags/}
CURRENT_VERSION=$(jq -r '.version' package.json)
if [ "$CURRENT_VERSION" != "$TAG_NAME" ]; then
jq --arg tag "$TAG_NAME" '.version = $tag' package.json > tmp.json && mv tmp.json package.json
git add package.json
git commit -m "Update package.json version to $TAG_NAME"
fi
- name: Update manifest.json
run: |
TAG_NAME=${{ github.ref }}
TAG_NAME=${TAG_NAME#refs/tags/}
CURRENT_VERSION=$(jq -r '.version' manifest.json)
if [ "$CURRENT_VERSION" != "$TAG_NAME" ]; then
jq --arg tag "$TAG_NAME" '.version = $tag' manifest.json > tmp.json && mv tmp.json manifest.json
git add manifest.json
git commit -m "Update manifest.json version to $TAG_NAME"
fi
- name: Push changes
run: |
git push origin HEAD:master
build:
runs-on: ubuntu-latest
needs: update_version

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -28,6 +83,7 @@ jobs:
mkdir dist
cp ./main.js ./manifest.json dist
cp ./main.js ./manifest.json ${{ env.PLUGIN_NAME }}
cp ./assets/styles.css ./assets/styles.css ${{ env.PLUGIN_NAME }}
zip -r ${{ env.PLUGIN_NAME }}.zip ${{ env.PLUGIN_NAME }}
ls
echo "::set-output name=tag_name::$(git tag --sort version:refname | tail -n 1)"
Expand Down Expand Up @@ -66,7 +122,7 @@ jobs:
asset_name: main.js
asset_content_type: text/javascript

- name: Upload custom.css
- name: Upload styles.css
id: upload-css
uses: actions/upload-release-asset@v1
env:
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "oencrypt",
"name": "OEncrypt",
"version": "1.0.0",
"version": "1.0.1",
"minAppVersion": "0.15.0",
"description": "A plugin for Obsidian that encrypts and decrypts notes using PGP, ensuring the security of your sensitive information.",
"author": "Xezard",
Expand Down
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
{
"name": "oencrypt",
"version": "1.0.0",
"version": "1.0.1",
"description": "A plugin for Obsidian that encrypts and decrypts notes using PGP, ensuring the security of your sensitive information.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
"version": "node version-bump.mjs && git add manifest.json versions.json"
},
"keywords": [],
"author": "",
"license": "MIT",
"keywords": [
"obsidian",
"plugin",
"pgp",
"encryption",
"cipher",
"password",
"security"
],
"author": "Xezard",
"license": "GPL-3.0",
"devDependencies": {
"@types/node": "^16.11.6",
"@types/pako": "^2.0.3",
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"1.0.0": "0.15.0"
"1.0.0": "0.15.0",
"1.0.1": "0.15.0"
}

0 comments on commit 38863b1

Please sign in to comment.