Skip to content

Commit 2ad29da

Browse files
authored
Merge pull request #8 from imgproxy/chore/changesets
Add changesets cli and npm publication from CI
2 parents 572f38f + 1ad6a40 commit 2ad29da

File tree

6 files changed

+919
-18
lines changed

6 files changed

+919
-18
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
env:
8+
CI: true
9+
jobs:
10+
Version:
11+
# prevents this action from running on forks
12+
if: github.repository == 'imgproxy/imgproxy-node'
13+
permissions:
14+
contents: write # to create release (changesets/action)
15+
pull-requests: write # to create pull request (changesets/action)
16+
id-token: write # OpenID Connect token needed for provenance
17+
timeout-minutes: 5
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- uses: actions/setup-node@v3
26+
with:
27+
node-version: 18
28+
cache: "npm"
29+
30+
- name: "Npm install"
31+
run: npm ci
32+
33+
- name: Build
34+
run: npm run build
35+
36+
- name: Create Release Pull Request or Publish to npm
37+
uses: changesets/action@v1
38+
with:
39+
version: npx @changesets/cli version
40+
publish: npx @changesets/cli publish
41+
commit: "Changesets versioning & publication"
42+
title: "Changesets: Versioning & Publication"
43+
createGithubReleases: true
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,14 @@ It takes the following arguments:
115115
- `key` (`string | undefined`) - (optional) hex-encoded key used to encode the URL. It must be a hex-encoded 16-byte string. This option overrides IMGPROXY_KEY from process.env for one request.
116116
- `encryptKey` (`string | undefined`) - (optional, **PRO feature**) hex-encoded key used to encrypt the URL. The key should be either 16, 24, or 32 bytes long for AES-128-CBC, AES-192-CBC, or AES-256-CBC, respectively. This option overrides IMGPROXY_SOURCE_URL_ENCRYPTION_KEY from process.env for one request.
117117
- `encryptIV` (`string | undefined`) - (optional, **PRO feature**) hex-encoded 16-bytes length IV for encrypting url. If not specified, the IV will be generated randomly. But it's better if you specify it yourself. Read more in [imgproxy docs iv-generation](https://docs.imgproxy.net/usage/encrypting_source_url#iv-generation).
118+
119+
120+
# Development
121+
122+
The project uses [changesets](https://github.com/changesets/changesets) to manage versioning and changelog.
123+
Typical workflow is as follows:
124+
1. make changes to codebase,
125+
2. run `npm run changesets` at project root and follow prompt to generate a "changeset" (logging a change),
126+
3. commit both (1) and (2) into git.
127+
128+
The [changesets Github action](./.github/workflows/publish.yml) is triggered on `push` to `main` and will create a corresponding "Changesets: Versioning & Publication" pull request, which, upon merged, will trigger publication of the new version to NPM.

0 commit comments

Comments
 (0)