From aa2ee90da0c2d7c763a7ee07fa7665e0537fba59 Mon Sep 17 00:00:00 2001 From: ergofriend Date: Wed, 2 Oct 2024 21:24:29 +0900 Subject: [PATCH 1/6] add build docs --- docs/BUILD.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 docs/BUILD.md diff --git a/docs/BUILD.md b/docs/BUILD.md new file mode 100644 index 0000000..b3d0af5 --- /dev/null +++ b/docs/BUILD.md @@ -0,0 +1,17 @@ +# How to build + +```sh +pnpm i +``` + +## chrome + +```sh +pnpm zip +``` + +## firefox + +```sh +pnpm zip:firefox +``` From c98cf1f47487e9fc3b38aa476c33a7d21f965f53 Mon Sep 17 00:00:00 2001 From: ergofriend Date: Sat, 5 Oct 2024 00:29:27 +0900 Subject: [PATCH 2/6] fix lint --- .github/workflows/lint.yml | 2 +- .github/workflows/release.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 856fd25..1804c75 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - cache: 'pnpm' + cache: "pnpm" - name: Install run: pnpm i --frozen-lockfile - name: lint diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f5ad2ba..f80e099 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,14 +3,14 @@ name: release on: push: tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: inputs: version: required: true type: string description: 'Deploy version without "v" ( ex: *.*.* )' - default: '' + default: "" jobs: build: @@ -46,7 +46,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - cache: 'pnpm' + cache: "pnpm" - name: Install run: pnpm i --frozen-lockfile - name: Build From a3612384b365770b066e62afd67e6584730b9605 Mon Sep 17 00:00:00 2001 From: ergofriend Date: Sat, 5 Oct 2024 00:31:38 +0900 Subject: [PATCH 3/6] add bump version workflow --- .github/api/createCommitOnBranch.gql | 23 +++++++++++++++ .github/workflows/bump.yml | 43 ++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 .github/api/createCommitOnBranch.gql create mode 100644 .github/workflows/bump.yml diff --git a/.github/api/createCommitOnBranch.gql b/.github/api/createCommitOnBranch.gql new file mode 100644 index 0000000..491f430 --- /dev/null +++ b/.github/api/createCommitOnBranch.gql @@ -0,0 +1,23 @@ +mutation ( + $githubRepository: String! + $branchName: String! + $expectedHeadOid: GitObjectID! + $commitMessage: String! + $files: [FileAddition!]! +) { + createCommitOnBranch( + input: { + branch: { + repositoryNameWithOwner: $githubRepository + branchName: $branchName + } + message: { headline: $commitMessage } + fileChanges: { additions: $files } + expectedHeadOid: $expectedHeadOid + } + ) { + commit { + url + } + } +} diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml new file mode 100644 index 0000000..a6687d2 --- /dev/null +++ b/.github/workflows/bump.yml @@ -0,0 +1,43 @@ +name: "Bump version" + +on: + workflow_dispatch: + inputs: + version: + required: true + default: "patch" + type: choice + options: + - major + - minor + - patch + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - run: corepack enable + - name: Setup + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: "pnpm" + - name: Bump version + id: bump_version + shell: bash + run: | + pnpm version ${{ github.event.inputs.version }} --no-commit-hooks --no-git-tag-version + echo "VERSION=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT + - name: commit + run: | + gh api graphql \ + -F $githubRepository=$GITHUB_REPOSITORY \ + -F branchName=$BRANCH \ + -F expectedHeadOid=$(git rev-parse HEAD) \ + -F commitMessage=":robot: Bump version to ${{ steps.bump_version.outputs.VERSION }}" \ + -F files[][path]="package.json" -F files[][contents]=$(base64 -w0 package.json) \ + -F 'query=@.github/api/createCommitOnBranch.gql' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6af2a008950b9a7edb58bd93e0b26621c9e6f245 Mon Sep 17 00:00:00 2001 From: ergofriend Date: Sat, 5 Oct 2024 00:34:02 +0900 Subject: [PATCH 4/6] add ref --- .github/api/createCommitOnBranch.gql | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/api/createCommitOnBranch.gql b/.github/api/createCommitOnBranch.gql index 491f430..d917d52 100644 --- a/.github/api/createCommitOnBranch.gql +++ b/.github/api/createCommitOnBranch.gql @@ -1,3 +1,4 @@ +# ref: https://dev.to/0xdbe/github-signing-commit-in-a-workflow-98p mutation ( $githubRepository: String! $branchName: String! From 93284d093c76bfce79ec1cb1d14894b39c059c9d Mon Sep 17 00:00:00 2001 From: ergofriend Date: Sat, 5 Oct 2024 00:37:42 +0900 Subject: [PATCH 5/6] update release docs --- docs/RELEASE.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/RELEASE.md b/docs/RELEASE.md index e764789..61f362d 100644 --- a/docs/RELEASE.md +++ b/docs/RELEASE.md @@ -1,10 +1,7 @@ -# Release +# How to release -## 1. Create a tag +## 1. Run "Bump version" Action -```sh -git tag vX.Y.Z; git push --tags -``` ## 2. Upload the zip file to the Chrome Web Store From 3dc2bada5f00ddf24e16de954abff9c26bcf9d08 Mon Sep 17 00:00:00 2001 From: ergofriend Date: Sat, 5 Oct 2024 00:43:18 +0900 Subject: [PATCH 6/6] add permissions --- .github/workflows/bump.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/bump.yml b/.github/workflows/bump.yml index a6687d2..f383895 100644 --- a/.github/workflows/bump.yml +++ b/.github/workflows/bump.yml @@ -1,5 +1,10 @@ name: "Bump version" +permissions: + checks: write + statuses: write + contents: write + on: workflow_dispatch: inputs: