Skip to content

Commit

Permalink
Merge pull request #6 from ergofriend/update-docs-and-ci
Browse files Browse the repository at this point in the history
Update docs and ci
  • Loading branch information
ergofriend authored Oct 4, 2024
2 parents 6ec9b6a + 3dc2bad commit 20d08a6
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 9 deletions.
24 changes: 24 additions & 0 deletions .github/api/createCommitOnBranch.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# ref: https://dev.to/0xdbe/github-signing-commit-in-a-workflow-98p
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
}
}
}
48 changes: 48 additions & 0 deletions .github/workflows/bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Bump version"

permissions:
checks: write
statuses: write
contents: write

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 '[email protected]/api/createCommitOnBranch.gql'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# How to build

```sh
pnpm i
```

## chrome

```sh
pnpm zip
```

## firefox

```sh
pnpm zip:firefox
```
7 changes: 2 additions & 5 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 20d08a6

Please sign in to comment.