Skip to content

Commit

Permalink
Update auto release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tamiroh committed Jan 23, 2024
1 parent 7051b3e commit 849316a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Release
on:
release:
types: [published]
workflow_dispatch:
env:
PLUGIN_NAME: obsidian-interval-timer
jobs:
Expand All @@ -11,8 +10,25 @@ jobs:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
id: release-drafter-prepare
with:
node-version: "16.x"
- name: Update draft
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update version
run: |
node ./bin/version-bump.mjs ${{ steps.release-drafter.outputs.tag_name }}
- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update version to ${{ steps.release-drafter.outputs.tag_name }}"
- name: Publish release
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
publish: true
- name: Build
id: build
run: |
Expand Down
6 changes: 3 additions & 3 deletions version-bump.mjs → bin/version-bump.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { readFileSync, writeFileSync } from "fs";

const targetVersion = process.env.npm_package_version;
const targetVersion = process.argv[2];

// read minAppVersion from manifest.json and bump version to target version
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
const { minAppVersion } = manifest;
manifest.version = targetVersion;
writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t"));
writeFileSync("manifest.json", JSON.stringify(manifest, null, "\t") + "\n");

// update versions.json with target version and minAppVersion from manifest.json
let versions = JSON.parse(readFileSync("versions.json", "utf8"));
versions[targetVersion] = minAppVersion;
writeFileSync("versions.json", JSON.stringify(versions, null, "\t"));
writeFileSync("versions.json", JSON.stringify(versions, null, "\t") + "\n");
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"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",
"prepare": "husky install"
},
"lint-staged": {
Expand Down
1 change: 0 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
{
"1.0.0": "0.15.0"
}

0 comments on commit 849316a

Please sign in to comment.