Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Commit 2e5ce94

Browse files
authored
Add outputs to get the preview-url and preview-name (#23)
* feat: add outputs to get the preview-url and preview-name (#22) * feat: add outputs to get the preview-url and preview-name * chore: add dist/ * minor changes * fix env variable in workflows * update version
1 parent 07ce847 commit 2e5ce94

File tree

8 files changed

+25
-6
lines changed

8 files changed

+25
-6
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ jobs:
2727
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
2828
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
2929
build-dir: "./example"
30-
github-env: "development"
30+
github-deployment-environment: "development"
3131
draft: true

.github/workflows/push.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
build-dir: "./example"
5656
comment-on-pull-request: true
5757
comment-on-commit: true
58-
github-env: "development"
58+
github-deployment-environment: "development"
5959
draft: true
6060
dry-run: true
6161

@@ -81,7 +81,7 @@ jobs:
8181
build-dir: "./example"
8282
comment-on-pull-request: true
8383
comment-on-commit: true
84-
github-env: "test"
84+
github-deployment-environment: "test"
8585
draft: true
8686

8787
deployProduction:
@@ -105,4 +105,4 @@ jobs:
105105
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
106106
build-dir: "./example"
107107
comment-on-commit: true
108-
github-env: "production"
108+
github-deployment-environment: "production"

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ There are 4 required inputs for the action
2323

2424
See the [action.yml](./action.yml) for other action inputs and their descriptions
2525

26+
## Outputs
27+
28+
### `preview-url`
29+
30+
The url of deployment preview.
31+
32+
### `preview-name`
33+
34+
The name of deployment name.
35+
2636
## Usage
2737

2838
Here are some ideas of how to configure this action in different workflows...

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ inputs:
6666
message:
6767
description: "A short message to associate with the deploy (Note: setting this will override the default deploy message of `<type>: <title> [short_sha]`)"
6868
required: false
69+
outputs:
70+
preview-url:
71+
description: "deployment preview URL"
72+
preview-name:
73+
description: "deployment preview name"

dist/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ function run() {
113113
const fnDir = functionsDir ? path.resolve(process.cwd(), functionsDir) : undefined;
114114
const deployment = yield netlifyClient.deploy(siteId, siteDir, { configPath, draft, fnDir, message });
115115
deploy = deployment.deploy;
116+
core.setOutput('preview-name', deploy.name);
117+
core.setOutput('preview-url', util_1.getDeployUrl(draft, deploy));
116118
}
117119
catch (error) {
118120
process.stderr.write('netlifyClient.deploy() failed\n');

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@south-paw/action-netlify-deploy",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "Netlify deployments via GitHub actions",
55
"keywords": [],
66
"homepage": "https://github.com/South-Paw/action-netlify-deploy",

src/main.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ async function run(): Promise<void> {
8484
const deployment = await netlifyClient.deploy(siteId, siteDir, { configPath, draft, fnDir, message });
8585

8686
deploy = deployment.deploy;
87+
core.setOutput('preview-name', deploy.name);
88+
core.setOutput('preview-url', getDeployUrl(draft, deploy));
8789
} catch (error) {
8890
process.stderr.write('netlifyClient.deploy() failed\n');
8991
process.stderr.write(`${JSON.stringify(error, null, 2)}\n`);

0 commit comments

Comments
 (0)