-
Notifications
You must be signed in to change notification settings - Fork 5.7k
161 lines (147 loc) · 6.03 KB
/
Copy pathsdk_publish.yaml
File metadata and controls
161 lines (147 loc) · 6.03 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: SDK and CLI Publish
on:
workflow_dispatch:
inputs:
version:
description: Version to release (start with "v")
required: true
default: 'v0.0.0-dev'
pypi_pkg_version:
description: 'PyPI package version (default: version)'
required: false
npm_pkg_version:
description: 'NPM package version (default: version)'
required: false
npm_tag:
description: 'NPM tag (default: latest)'
required: false
default: 'latest'
rubygems_pkg_version:
description: 'RubyGems package version (default: version)'
required: false
maven_pkg_version:
description: 'Maven package version (default: version)'
required: false
env:
VERSION: ${{ inputs.version }}
PYPI_PKG_VERSION: ${{ inputs.pypi_pkg_version || inputs.version}}
NPM_PKG_VERSION: ${{ inputs.npm_pkg_version || inputs.version}}
RUBYGEMS_PKG_VERSION: ${{ inputs.rubygems_pkg_version || inputs.version}}
MAVEN_PKG_VERSION: ${{ inputs.maven_pkg_version || inputs.version}}
NPM_TAG: ${{ inputs.npm_tag }}
POETRY_VIRTUALENVS_IN_PROJECT: true
permissions: {}
jobs:
publish:
if: github.repository == 'daytonaio/daytona'
runs-on: blacksmith-16vcpu-ubuntu-2404
permissions:
contents: read
name: Publish ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: TypeScript SDK
projects: sdk-typescript
- name: OpenCode Plugin
projects: opencode-plugin
# sdk-typescript is published by its own job; without this flag
# opencode-plugin's publish would re-publish it via nx dependsOn
exclude-task-deps: 'true'
- name: Pi Extension
projects: pi-extension
- name: Analytics API Client
projects: analytics-api-client
- name: Analytics API Client Python
projects: analytics-api-client-python
- name: Analytics API Client Python Async
projects: analytics-api-client-python-async
- name: Analytics API Client Ruby
projects: analytics-api-client-ruby
- name: Analytics API Client Java
projects: analytics-api-client-java
- name: Billing API Client
projects: billing-api-client
- name: Python SDK
projects: sdk-python
- name: Ruby SDK
projects: sdk-ruby
- name: Java SDK
projects: sdk-java
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
MAVEN_GPG_SIGNING_KEY: ${{ secrets.MAVEN_GPG_SIGNING_KEY }}
MAVEN_GPG_SIGNING_PASSWORD: ${{ secrets.MAVEN_GPG_SIGNING_PASSWORD }}
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
steps:
- name: Validate version format
run: |
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "::error::Invalid version format: $VERSION (expected vX.Y.Z or vX.Y.Z-suffix)"
exit 1
fi
- name: Checkout code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-tags: true
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/setup-toolchain
with:
install-swag: 'false'
- name: Configure git
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.name "Daytona Release Bot"
git config --global user.email "daytona-release@users.noreply.github.com"
- name: Configure RubyGems credentials
if: matrix.projects == 'sdk-ruby'
run: |
mkdir -p ~/.gem
echo "---" > ~/.gem/credentials
echo ":rubygems_api_key: $RUBYGEMS_API_KEY" >> ~/.gem/credentials
chmod 0600 ~/.gem/credentials
- name: Publish projects
run: |
source "$(poetry env info --path)/bin/activate"
if [ "${{ matrix.exclude-task-deps }}" = "true" ]; then
yarn nx run-many --target=build --projects=${{ matrix.projects }}
yarn nx run-many --target=publish --projects=${{ matrix.projects }} --excludeTaskDependencies
else
yarn nx run-many --target=publish --projects=${{ matrix.projects }}
fi
- name: Cleanup credentials
if: always()
run: |
rm -f ~/.gem/credentials 2>/dev/null || true
docker logout docker.io 2>/dev/null || true
docker logout ghcr.io 2>/dev/null || true
git config --global --fixed-value --unset-all user.name "Daytona Release Bot" 2>/dev/null || true
git config --global --fixed-value --unset-all user.email "daytona-release@users.noreply.github.com" 2>/dev/null || true
git config --global --fixed-value --unset-all safe.directory "$GITHUB_WORKSPACE" 2>/dev/null || true
git remote set-url origin "https://github.com/${GITHUB_REPOSITORY}" 2>/dev/null || true
update-homebrew-tap:
if: ${{ github.repository == 'daytonaio/daytona' && inputs.npm_tag == 'latest' }}
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions: {}
name: Update Homebrew CLI tap
steps:
- name: Validate version format
run: |
if [[ ! "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "::error::Invalid version format: $VERSION (expected vX.Y.Z or vX.Y.Z-suffix)"
exit 1
fi
- name: Update version
run: |
curl -f -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUBBOT_TOKEN}" \
https://api.github.com/repos/daytonaio/homebrew-cli/dispatches \
-d "{\"event_type\": \"update-version\", \"client_payload\": {\"version\": \"$VERSION\"}}"
env:
GITHUBBOT_TOKEN: ${{ secrets.GITHUBBOT_TOKEN }}