Skip to content

Commit 4fa622a

Browse files
authored
Add changesets (#4)
* add changeset * Add changesets * remove check.yml
1 parent f840880 commit 4fa622a

File tree

7 files changed

+775
-112
lines changed

7 files changed

+775
-112
lines changed

.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": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/honest-goats-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@inato/custom-instrumentations-node": patch
3+
---
4+
5+
add changesets

.github/workflows/check.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/docker.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 74 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
name: Release
1+
name: Publish Docker image
22
on:
3-
{}
4-
# push:
5-
# branches: [main]
3+
push:
4+
branches: [main]
65

76
concurrency:
87
group: ${{ github.workflow }}-${{ github.ref }}
@@ -15,8 +14,18 @@ permissions:
1514
packages: write
1615

1716
jobs:
17+
build:
18+
name: Build
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 10
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Install dependencies
24+
uses: ./.github/actions/setup
25+
- run: pnpm build
1826
release:
1927
name: Release
28+
needs: build
2029
runs-on: ubuntu-latest
2130
timeout-minutes: 10
2231
permissions:
@@ -27,11 +36,64 @@ jobs:
2736
- uses: actions/checkout@v4
2837
- name: Install dependencies
2938
uses: ./.github/actions/setup
30-
# - name: Create Release Pull Request or Publish
31-
# uses: changesets/action@v1
32-
# with:
33-
# version: pnpm changeset-version
34-
# publish: pnpm changeset-publish
35-
# env:
36-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
- name: Create Release Pull Request or Publish
40+
uses: changesets/action@v1
41+
with:
42+
version: pnpm changeset-version
43+
publish: pnpm changeset-publish
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
publish:
48+
# only publish docker image after changesets has bumped the package version
49+
if: contains(github.event.head_commit.message, 'Version Packages')
50+
needs: release
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Read version
57+
run: echo VERSION=$(cat package.json | jq -r '.version') >> $GITHUB_ENV
58+
59+
- name: Docker meta
60+
id: meta
61+
uses: docker/metadata-action@v5
62+
with:
63+
images: |
64+
ghcr.io/inato/custom-instrumentations-nodejs
65+
tags: |
66+
type=match,pattern=v(.*),group=1,value=v${{ env.VERSION }}
67+
68+
- name: Set up QEMU
69+
uses: docker/setup-qemu-action@v3
70+
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Cache Docker layers
75+
uses: actions/cache@v4
76+
with:
77+
path: /tmp/.buildx-cache
78+
key: ${{ runner.os }}-buildx-${{ github.sha }}
79+
restore-keys: |
80+
${{ runner.os }}-buildx-
81+
82+
- name: Login to GitHub Package Registry
83+
uses: docker/login-action@v3
84+
with:
85+
registry: ghcr.io
86+
username: ${{ github.repository_owner }}
87+
password: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- name: Build and push
90+
uses: docker/build-push-action@v6
91+
with:
92+
context: .
93+
platforms: linux/amd64,linux/arm64
94+
push: true
95+
build-args: version=${{ env.VERSION }}
96+
tags: ${{ steps.meta.outputs.tags }}
97+
labels: ${{ steps.meta.outputs.labels }}
98+
cache-from: type=local,src=/tmp/.buildx-cache
99+
cache-to: type=local,dest=/tmp/.buildx-cache

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
},
1414
"type": "module",
1515
"scripts": {
16-
"build": "tsc -p ."
16+
"build": "tsc -p .",
17+
"changeset-version": "changeset version",
18+
"changeset-publish": "pnpm build && changeset publish"
1719
},
1820
"dependencies": {
1921
"@opentelemetry/sdk-node": "0.57.2",
@@ -23,7 +25,8 @@
2325
},
2426
"devDependencies": {
2527
"typescript": "5.8.2",
26-
"@types/node": "22.13.9"
28+
"@types/node": "22.13.9",
29+
"@changesets/cli": "2.28.1"
2730
},
2831
"author": "Inato",
2932
"license": "ISC",

0 commit comments

Comments
 (0)