Skip to content

Commit 504d4aa

Browse files
committed
Update api version to stable v7
Change-type: patch
1 parent 5b9b38e commit 504d4aa

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ with:
7777
with:
7878
balena-token: "*****"
7979
release-id: 123456
80-
key-prefix: "prefix"
80+
key-prefix: "prefix/"
8181
file-path: |
8282
/some/path/licenses.tgz
8383
/some/other/
@@ -92,7 +92,7 @@ with:
9292
## About asset keys and paths
9393
The asset key is a unique identifier for the asset within the release. By default, the action uses the slugified file name with its least common ancestor relative path as the asset key. If you provide a `key-prefix`, it will append the slugified file name to that prefix.
9494

95-
For example, if you only upload a file located at `/some/path/licenses.tgz`, the default asset key would be `licenses-tgz`. If you set `key-prefix` to `my-prefix`, the asset key would be `my-prefix-licenses-tgz`.
95+
For example, if you only upload a file located at `/some/path/licenses.tgz`, the default asset key would be `licenses.tgz`. If you set `key-prefix` to `my-prefix/`, the asset key would be `my-prefix/licenses.tgz`.
9696

9797
More over, if you have a folder structure like this:
9898

@@ -103,12 +103,12 @@ More over, if you have a folder structure like this:
103103
/some/other/excluded-file.txt
104104
```
105105

106-
with the above action (which has a `key-prefix` of `prefix`), the asset keys would be:
106+
with the above action (which has a `key-prefix` of `prefix/`), the asset keys would be:
107107

108108
```
109-
prefix-path-licenses-tgz
110-
prefix-other-file-txt
111-
prefix-other-another-file-txt
109+
prefix/path/licenses.tgz
110+
prefix/other/file.txt
111+
prefix/other/another/file.txt
112112
# and nothing for excluded-file.txt as it is excluded by the pattern
113113
```
114114

build/index.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/api.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ export class BalenaAPI {
4646
}
4747

4848
public async canAccessRelease(releaseId: number) {
49-
await this.request.post(`resin/release(${releaseId})/canAccess`, {
49+
await this.request.post(`v7/release(${releaseId})/canAccess`, {
5050
json: { action: 'update' },
5151
});
5252
}
5353

5454
public async getReleaseAssetId(releaseId: number, assetKey: string) {
5555
const res = await this.request.get<ODataID>(
56-
`resin/release_asset(release=${releaseId},asset_key='${assetKey}')?$select=id`,
56+
`v7/release_asset(release=${releaseId},asset_key='${assetKey}')?$select=id`,
5757
);
5858

5959
const body = await res.json();
@@ -67,7 +67,7 @@ export class BalenaAPI {
6767
): Promise<number> {
6868
try {
6969
const create = await this.request.post<{ id: number }>(
70-
'resin/release_asset',
70+
'v7/release_asset',
7171
{
7272
json: {
7373
asset_key: assetKey,
@@ -93,7 +93,7 @@ export class BalenaAPI {
9393
chunkSize: number,
9494
) {
9595
const res = await this.request.post<ReleaseAssetBeginUpload>(
96-
`resin/release_asset(${releaseAssetId})/beginUpload`,
96+
`v7/release_asset(${releaseAssetId})/beginUpload`,
9797
{
9898
json: {
9999
asset: {
@@ -115,7 +115,7 @@ export class BalenaAPI {
115115
providerCommitData: ProviderCommitPayload,
116116
) {
117117
const res = await this.request.post<{ href: string }>(
118-
`resin/release_asset(${releaseAssetId})/commitUpload`,
118+
`v7/release_asset(${releaseAssetId})/commitUpload`,
119119
{
120120
json: { uuid, providerCommitData },
121121
},
@@ -126,7 +126,7 @@ export class BalenaAPI {
126126

127127
public async cancelMultiPartUpload(releaseAssetId: number, uuid: string) {
128128
return await this.request.post(
129-
`resin/release_asset(${releaseAssetId})/cancelUpload`,
129+
`v7/release_asset(${releaseAssetId})/cancelUpload`,
130130
{
131131
json: { uuid },
132132
},

src/uploader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,22 @@ export class ReleaseAssetUploader {
6464

6565
if (releaseAssetId != null) {
6666
info('Release asset already exists, overriding...');
67-
await this.api.request.patch(`resin/release_asset(${releaseAssetId})`, {
67+
await this.api.request.patch(`v7/release_asset(${releaseAssetId})`, {
6868
body: form,
6969
});
7070
} else {
7171
debug('Release asset does not exist, creating a new one');
7272
form.append('asset_key', assetKey);
7373
form.append('release', `${releaseId}`);
74-
await this.api.request.post('resin/release_asset', {
74+
await this.api.request.post('v7/release_asset', {
7575
body: form,
7676
});
7777
}
7878

7979
const res = await this.api.request.get<
8080
OData<{ id: number; asset: { href: string } }>
8181
>(
82-
`resin/release_asset(release=${releaseId},asset_key='${assetKey}')?$select=id,asset`,
82+
`v7/release_asset(release=${releaseId},asset_key='${assetKey}')?$select=id,asset`,
8383
);
8484

8585
const body = await res.json();

0 commit comments

Comments
 (0)