This repository was archived by the owner on Apr 17, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
124 lines (108 loc) · 4.13 KB
/
Copy pathrelease.yml
File metadata and controls
124 lines (108 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Release
on:
push:
branches:
- master
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
packages: write
pull-requests: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git signoff for bot commits
run: |
mkdir -p .git/hooks
cat > .git/hooks/prepare-commit-msg << 'EOF'
#!/bin/sh
if ! grep -q "^Signed-off-by:" "$1"; then
printf "\nSigned-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>\n" >> "$1"
fi
EOF
chmod +x .git/hooks/prepare-commit-msg
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Create release PR or publish packages
id: changesets
uses: changesets/action@v1
with:
commit: "chore: release packages"
title: "chore: release packages"
version: pnpm version-packages
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Detect sandbox package release
id: sandbox-package
if: steps.changesets.outputs.published == 'true'
env:
PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
run: |
node <<'NODE'
const fs = require("node:fs");
const publishedPackages = JSON.parse(process.env.PUBLISHED_PACKAGES || "[]");
const sandboxPackage = publishedPackages.find((pkg) => pkg.name === "@agentrail/sandbox");
if (!sandboxPackage) {
fs.appendFileSync(process.env.GITHUB_OUTPUT, "published=false\n");
process.exit(0);
}
fs.appendFileSync(process.env.GITHUB_OUTPUT, `published=true\nversion=${sandboxPackage.version}\n`);
NODE
- name: Compute sandbox tags
id: sandbox-tags
if: steps.sandbox-package.outputs.published == 'true'
env:
VERSION: ${{ steps.sandbox-package.outputs.version }}
run: |
IFS='.' read -r major minor patch <<< "$VERSION"
{
echo "version=$VERSION"
echo "major=$major"
echo "minor=$major.$minor"
echo "image=ghcr.io/yai-dev/agentrail-sandbox"
} >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
if: steps.sandbox-package.outputs.published == 'true'
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
if: steps.sandbox-package.outputs.published == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push sandbox image
if: steps.sandbox-package.outputs.published == 'true'
uses: docker/build-push-action@v6
with:
context: docker/sandbox
push: true
tags: |
${{ steps.sandbox-tags.outputs.image }}:${{ steps.sandbox-tags.outputs.version }}
${{ steps.sandbox-tags.outputs.image }}:${{ steps.sandbox-tags.outputs.minor }}
${{ steps.sandbox-tags.outputs.image }}:${{ steps.sandbox-tags.outputs.major }}
${{ steps.sandbox-tags.outputs.image }}:latest
labels: |
org.opencontainers.image.title=agentrail-sandbox
org.opencontainers.image.description=Docker-based sandbox execution and browser automation for Agentrail.
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ steps.sandbox-tags.outputs.version }}