diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c1092d1..f5a30383 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,7 @@ jobs: - name: Create a simple Web site run: mkdir -p deploy_dist && echo -e "
$(date -u)\n$GITHUB_SHA\n$GITHUB_REF
" > deploy_dist/index.html - uses: ./ + id: deploy-to-netlify with: publish-dir: './deploy_dist' production-branch: master @@ -26,3 +27,4 @@ jobs: env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + - run: "echo 'outputs.deploy-url: ${{ steps.deploy-to-netlify.outputs.deploy-url }}'" diff --git a/CHANGELOG.md b/CHANGELOG.md index ed3cb79d..111c696e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) ## [Unreleased] +## [1.0.6] - 2020-03-17 +### Changed +* Update dependencies + +### Added +* Add `deploy-url` output [#48](https://github.com/nwtgck/actions-netlify/pull/48) by [@kentaro-m](https://github.com/kentaro-m) + ## [1.0.5] - 2020-03-03 ### Added * Add `deploy-message` input [#40](https://github.com/nwtgck/actions-netlify/pull/40) by [@South-Paw](https://github.com/South-Paw) @@ -47,7 +54,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) * Deploy to Netlify * Comment on GitHub PR -[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.0.5...HEAD +[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.0.6...HEAD +[1.0.6]: https://github.com/nwtgck/actions-netlify/compare/v1.0.5...v1.0.6 [1.0.5]: https://github.com/nwtgck/actions-netlify/compare/v1.0.4...v1.0.5 [1.0.4]: https://github.com/nwtgck/actions-netlify/compare/v1.0.3...v1.0.4 [1.0.3]: https://github.com/nwtgck/actions-netlify/compare/v1.0.2...v1.0.3 diff --git a/README.md b/README.md index 1bc11035..65f0d3a0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # actions-netlify ![build-test](https://github.com/nwtgck/actions-netlify/workflows/build-test/badge.svg) -GitHub Actions for deploying Netlify +GitHub Actions for deploying to Netlify @@ -37,13 +37,26 @@ jobs: NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} ``` -### Required parameters + +### Required inputs and env - `publish-dir` (e.g. "dist", "_site") - `NETLIFY_AUTH_TOKEN`: [Personal access tokens](https://app.netlify.com/user/applications#personal-access-tokens) > New access token - `NETLIFY_SITE_ID`: team page > your site > Settings > Site details > Site information > API ID - NOTE: API ID is `NETLIFY_SITE_ID`. -### Optional parameters +### Optional inputs - `production-branch` (e.g. "master") - `github-token: ${{ secrets.GITHUB_TOKEN }}` - `deploy-message` A custom deploy message to see on Netlify deployment (e.g. `${{ github.event.pull_request.title }}`) + +### Outputs +- `deploy-url` A deployment URL generated by Netlify + +## Build on local + +```bash +npm ci +# NOTE: ./dist/typescript is generated automatically and causes type errors. (see: https://github.com/nwtgck/actions-netlify/issues/28) +rm -r dist +npm run all +``` diff --git a/action.yml b/action.yml index 971cd06c..465e3749 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,9 @@ inputs: production-branch: description: Production branch required: false +outputs: + deploy-url: + description: Deploy URL runs: using: 'node12' main: 'dist/index.js' diff --git a/dist/index.js b/dist/index.js index 174a8977..53f570aa 100644 --- a/dist/index.js +++ b/dist/index.js @@ -181504,6 +181504,8 @@ function run() { : `šŸŽ‰ Published on ${deploy.deploy.ssl_url} as production\nšŸš€ Deployed on ${deploy.deploy.deploy_ssl_url}`; // Print the URL process.stdout.write(`${message}\n`); + // Set the deploy URL to outputs for GitHub Actions + core.setOutput('deploy-url', isDraft ? deploy.deploy.deploy_ssl_url : deploy.deploy.ssl_url); // Get GitHub token const githubToken = core.getInput('github-token'); if (githubToken !== '') { diff --git a/package-lock.json b/package-lock.json index ccbbc36e..746d81af 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "actions-netlify", - "version": "1.0.5", + "version": "1.0.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1383,9 +1383,9 @@ } }, "@types/jest": { - "version": "25.1.3", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.3.tgz", - "integrity": "sha512-jqargqzyJWgWAJCXX96LBGR/Ei7wQcZBvRv0PLEu9ZByMfcs23keUJrKv9FMR6YZf9YCbfqDqgmY+JUBsnqhrg==", + "version": "25.1.4", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-25.1.4.tgz", + "integrity": "sha512-QDDY2uNAhCV7TMCITrxz+MRk1EizcsevzfeS6LykIlq2V1E5oO4wXG8V2ZEd9w7Snxeeagk46YbMgZ8ESHx3sw==", "dev": true, "requires": { "jest-diff": "^25.1.0", @@ -1399,9 +1399,9 @@ "dev": true }, "@types/node": { - "version": "12.12.29", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.29.tgz", - "integrity": "sha512-yo8Qz0ygADGFptISDj3pOC9wXfln/5pQaN/ysDIzOaAWXt73cNHmtEC8zSO2Y+kse/txmwIAJzkYZ5fooaS5DQ==" + "version": "12.12.30", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.30.tgz", + "integrity": "sha512-sz9MF/zk6qVr3pAnM0BSQvYIBK44tS75QC5N+VbWSE4DjCV/pJ+UzCW/F+vVnl7TkOPcuwQureKNtSSwjBTaMg==" }, "@types/stack-utils": { "version": "1.0.1", @@ -1477,43 +1477,60 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "2.21.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.21.0.tgz", - "integrity": "sha512-olKw9JP/XUkav4lq0I7S1mhGgONJF9rHNhKFn9wJlpfRVjNo3PPjSvybxEldvCXnvD+WAshSzqH5cEjPp9CsBA==", + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz", + "integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.21.0", + "@typescript-eslint/typescript-estree": "2.22.0", "eslint-scope": "^5.0.0" + }, + "dependencies": { + "@typescript-eslint/typescript-estree": { + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz", + "integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^6.3.0", + "tsutils": "^3.17.1" + } + } } }, "@typescript-eslint/parser": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.22.0.tgz", - "integrity": "sha512-FaZKC1X+nvD7qMPqKFUYHz3H0TAioSVFGvG29f796Nc5tBluoqfHgLbSFKsh7mKjRoeTm8J9WX2Wo9EyZWjG7w==", + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.23.0.tgz", + "integrity": "sha512-k61pn/Nepk43qa1oLMiyqApC6x5eP5ddPz6VUYXCAuXxbmRLqkPYzkFRKl42ltxzB2luvejlVncrEpflgQoSUg==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "2.22.0", - "@typescript-eslint/typescript-estree": "2.22.0", + "@typescript-eslint/experimental-utils": "2.23.0", + "@typescript-eslint/typescript-estree": "2.23.0", "eslint-visitor-keys": "^1.1.0" }, "dependencies": { "@typescript-eslint/experimental-utils": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.22.0.tgz", - "integrity": "sha512-sJt1GYBe6yC0dWOQzXlp+tiuGglNhJC9eXZeC8GBVH98Zv9jtatccuhz0OF5kC/DwChqsNfghHx7OlIDQjNYAQ==", + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.23.0.tgz", + "integrity": "sha512-OswxY59RcXH3NNPmq+4Kis2CYZPurRU6mG5xPcn24CjFyfdVli5mySwZz/g/xDbJXgDsYqNGq7enV0IziWGXVQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.22.0", + "@typescript-eslint/typescript-estree": "2.23.0", "eslint-scope": "^5.0.0" } }, "@typescript-eslint/typescript-estree": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.22.0.tgz", - "integrity": "sha512-2HFZW2FQc4MhIBB8WhDm9lVFaBDy6h9jGrJ4V2Uzxe/ON29HCHBTj3GkgcsgMWfsl2U5as+pTOr30Nibaw7qRQ==", + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.23.0.tgz", + "integrity": "sha512-pmf7IlmvXdlEXvE/JWNNJpEvwBV59wtJqA8MLAxMKLXNKVRC3HZBXR/SlZLPWTCcwOSg9IM7GeRSV3SIerGVqw==", "dev": true, "requires": { "debug": "^4.1.1", @@ -1554,9 +1571,9 @@ "dev": true }, "acorn": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.0.tgz", - "integrity": "sha512-gac8OEcQ2Li1dxIEWGZzsp2BitJxwkwcOm0zHAJLcPJaVvm58FRnk6RkuLRpU1EujipU2ZFODv2P9DLMfnV8mw==", + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz", + "integrity": "sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA==", "dev": true }, "acorn-globals": { @@ -3151,9 +3168,9 @@ } }, "eslint-plugin-jest": { - "version": "23.8.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.1.tgz", - "integrity": "sha512-OycLNqPo/2EfO6kTqnmsu1khz1gTIOxGl3ThIVwL5/oycDF4pm5uNDyvFelNLdpr4COUuM8PVi3963NEG1Efpw==", + "version": "23.8.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.8.2.tgz", + "integrity": "sha512-xwbnvOsotSV27MtAe7s8uGWOori0nUsrXh2f1EnpmXua8sDfY6VZhHAhHg2sqK7HBNycRQExF074XSZ7DvfoFg==", "dev": true, "requires": { "@typescript-eslint/experimental-utils": "^2.5.0" @@ -6482,9 +6499,9 @@ }, "dependencies": { "acorn": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.0.tgz", - "integrity": "sha512-kL5CuoXA/dgxlBbVrflsflzQ3PAas7RYZB52NOm/6839iVYJgKMJ3cQJD+t2i5+qFa8h3MDpEOJiS64E8JLnSQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.1.1.tgz", + "integrity": "sha512-add7dgA5ppRPxCFJoAGfMDi7PIBXq1RtGo7BhbLaxwrXPOmw8gq48Y9ozT01hUKy9byMjlR20EJhu5zlkErEkg==", "dev": true } } diff --git a/package.json b/package.json index f6b40a0c..90f3a876 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "actions-netlify", - "version": "1.0.5", + "version": "1.0.6", "private": true, "description": "GitHub Actions for Netlify", "main": "lib/main.js", @@ -29,13 +29,13 @@ "netlify": "^3.1.0" }, "devDependencies": { - "@types/jest": "^25.1.3", - "@types/node": "^12.12.29", - "@typescript-eslint/parser": "^2.22.0", + "@types/jest": "^25.1.4", + "@types/node": "^12.12.30", + "@typescript-eslint/parser": "^2.23.0", "@zeit/ncc": "^0.21.1", "eslint": "^5.16.0", "eslint-plugin-github": "^2.0.0", - "eslint-plugin-jest": "^23.8.1", + "eslint-plugin-jest": "^23.8.2", "jest": "^25.1.0", "jest-circus": "^25.1.0", "js-yaml": "^3.13.1", diff --git a/src/main.ts b/src/main.ts index 8ffd614a..4cc08239 100644 --- a/src/main.ts +++ b/src/main.ts @@ -34,6 +34,12 @@ async function run(): Promise { // Print the URL process.stdout.write(`${message}\n`) + // Set the deploy URL to outputs for GitHub Actions + core.setOutput( + 'deploy-url', + isDraft ? deploy.deploy.deploy_ssl_url : deploy.deploy.ssl_url + ) + // Get GitHub token const githubToken = core.getInput('github-token') if (githubToken !== '') {