Skip to content

Commit 959bf99

Browse files
authored
Merge pull request #7 from ZephyrCloudIO/chore-error-handling
chore: error handling
2 parents 2ccf882 + c61d735 commit 959bf99

File tree

4 files changed

+40
-8
lines changed

4 files changed

+40
-8
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
name: Build and Deploy
12
on:
23
push:
34
branches:
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build App on Pull Request
2+
on:
3+
pull_request:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Branch to run workflow on'
8+
required: true
9+
default: 'main'
10+
11+
jobs:
12+
build_app:
13+
runs-on: ubuntu-latest
14+
environment: development
15+
name: Build
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: NPM install
20+
run: npm ci
21+
- name: Build App
22+
env:
23+
ZE_SECRET_TOKEN: ${{ secrets.ZE_SECRET_TOKEN }}
24+
ZE_API: ${{ vars.ZE_API }}
25+
ZE_API_GATE: ${{ vars.ZE_API_GATE }}
26+
run: |
27+
cd zephyr-examples/create-mf-app-rspack
28+
npm ci
29+
npm run build
30+
- name: Zephyr deploy summary
31+
uses: ./ # Uses an action in the root directory
32+
id: zephyr-summary
33+
with:
34+
application_uid: create-mf-app-rspack-host.deploy-summary-action.zephyrcloudio
35+
- name: Print zephyr deploy summary
36+
run: echo "Deployed to ${{ steps.zephyr-summary.outputs.version_url }}"
37+

index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27157,22 +27157,14 @@ var import_core = __toESM(require_core());
2715727157
var createJobSummary = async ({ appName, repoName, orgName, version_url, context: context2 }) => {
2715827158
await import_core.summary.addRaw(`Deployed ${appName}!`);
2715927159
await import_core.summary.addEOL();
27160-
const lastCommit = getLastCommit(context2);
2716127160
const tableData = [
2716227161
[{ data: "Application" }, { data: appName }],
2716327162
[{ data: "Project" }, { data: repoName }],
2716427163
[{ data: "Organization" }, { data: orgName }],
27165-
[{ data: "Last commit" }, { data: `<a href="https://github.com/${orgName}/${repoName}/commit/${lastCommit.id}">${lastCommit.id}</a>` }],
27166-
[{ data: "Last commit author" }, { data: `@${lastCommit.author.username}` }],
27167-
[{ data: "Last commit message" }, { data: lastCommit.message }],
2716827164
[{ data: "Version URL" }, { data: `<a class="external" href=${version_url} target="_blank">${version_url}</a>` }]
2716927165
];
2717027166
await import_core.summary.addTable(tableData).write();
2717127167
};
27172-
function getLastCommit(context2) {
27173-
const payload = context2.payload;
27174-
return payload.head_commit;
27175-
}
2717627168

2717727169
// src/get-deploy-version-url.ts
2717827170
var import_zephyr_edge_contract = __toESM(require_dist());
@@ -27194,6 +27186,7 @@ var getDeployVersionUrl = async (application_uid) => {
2719427186
(0, import_core2.setOutput)("version_url", version_url);
2719527187
await createJobSummary({ appName, repoName, orgName, version_url, context: import_github.context });
2719627188
} catch (error) {
27189+
console.error(error);
2719727190
(0, import_core2.setFailed)(error.message);
2719827191
}
2719927192
})();

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getDeployVersionUrl } from './get-deploy-version-url';
1919
await createJobSummary({appName, repoName, orgName, version_url, context});
2020

2121
} catch (error) {
22+
console.error(error);
2223
setFailed(error.message);
2324
}
2425
})();

0 commit comments

Comments
 (0)