Compare commits

..
140 Commits
Author SHA1 Message Date
Alif Rachmawadi b1d33bca25 print version 2022-07-25 19:47:52 +07:00
Alif Rachmawadi e5fb13927b update readme 2022-07-25 19:36:41 +07:00
Alif Rachmawadi ebff0a3874 tidy up 2022-07-25 19:15:22 +07:00
Alif Rachmawadi d8cf9a8ccc tidy up 2022-07-25 18:58:09 +07:00
Alif Rachmawadi e09ab0131a remove opencollective 2022-07-24 21:17:47 +07:00
Alif Rachmawadi becfb71246 shellcheck linter 2022-07-24 19:30:59 +07:00
Alif RachmawadiandGitHub 54864698df test mode and cache key builder (#175) 2022-07-24 19:19:31 +07:00
Alif Rachmawadi ea686d7c56 check jq 2022-07-19 12:00:34 +07:00
Alif Rachmawadi 9c6ea81337 check jq, fixes #170 2022-07-19 06:32:29 +07:00
Jiun KimandGitHub 29ad5bdaf4 Update for any-version on any-channel (#155)
* Update for testing any-version on any-channel

* Update `latest_version` and Add `latest_channel_version`
2022-06-05 16:06:25 +07:00
Jiun KimandGitHub 0c3f14223a Update cache-key with Runner.os and Arch (#152)
* Add `${{ runner.os }}` on cache-key

* Add `${{ inputs.architecture }}` as Cache-key
2022-04-29 09:03:21 +07:00
Jiun KimandGitHub 0f2cd3391b Update architecture default as runner.arch (#153)
* Update architecture default as `runner.arch`

* Update to convert `ARCH` as lowercase

* Refactor for `ARCH` variable
2022-04-29 07:52:26 +07:00
Jiun KimandGitHub cf0b7b2cac Update for actions/cache version to 3 (#150) 2022-04-27 10:24:59 +07:00
Alif Rachmawadi d8687e6979 add open collective funding 2022-04-20 06:42:47 +07:00
GooolerandGitHub 2fcd5629bc Bump actions/checkout to v3 (#145) 2022-04-19 17:54:50 +07:00
菘菘andGitHub 6a13bd0836 feat: support to set architecture of SDK executable (#147)
* feat: support to set architecture of SDK executable

* docs: update

* fix: try fix tests

* ci: set `fail-fast` to false

* fix: get latest version sdk

* fix: test any version

* fix: legacy version format

* fix: tests

* revert changes for `.github/workflows/workflow.yml`

* Update workflow.yml

* rename `ARCHITECTURE` to `ARCH`

* follow the existing spacing

* style: simplified code

* Update setup.sh

* style
2022-04-19 16:08:46 +07:00
Alif Rachmawadi f0cc0311e0 update .pub-cache location 2022-03-31 12:45:08 +07:00
Alif Rachmawadi 5e1529bc12 update readme 2022-02-07 23:42:26 +00:00
Alif RachmawadiandGitHub 99cf4656b5 Merge pull request #134 from kuhnroyal/temp-folder-windows
Fix temp folder handling on windows
2022-02-04 23:44:20 +07:00
Peter Leibiger b3c14e7ecc Fix temp folder handling on windows
Something with the globing seems not work but not sure exactly. Now using a simple way of ensure that the target folder never exists when calling `mv` so that it behaves as a rename instead of a move into. The folder still needs to be created first so that parent folders (in case of a custom cache path) are created.
2022-02-04 17:30:43 +01:00
Alif RachmawadiandGitHub 05b7251cb1 Merge pull request #133 from davidmigloz/main
Remove dev channel mentions
2022-02-04 18:19:49 +07:00
David Miguel Lozano 2d3283596d Remove dev channel 2022-02-04 12:04:07 +01:00
Alif Rachmawadi b5a1c34304 run workflow on pull request 2022-02-04 10:30:09 +00:00
Alif RachmawadiandGitHub 77740fc108 Merge pull request #132 from kuhnroyal/temp-folder
Download and unzip to temp folder and not $HOME
2022-02-04 17:24:54 +07:00
Peter Leibiger 36e70a6528 Download and unzip to temp folder and not $HOME 2022-02-03 23:50:13 +01:00
Alif Rachmawadi d5878a0492 quiet unzip (fixes #130) 2022-01-24 04:44:12 +00:00
Alif Rachmawadi 31089a7435 update readme 2022-01-13 11:02:57 +00:00
Alif Rachmawadi 4f5d1c6d12 add cache path option 2022-01-13 10:46:00 +00:00
Alif Rachmawadi 03e576dcd6 actions/cache integration 2022-01-10 04:45:27 +00:00
Alif Rachmawadi f95a8c953b add actions/cache support 2022-01-07 04:54:02 +00:00
Alif Rachmawadi 3dae472464 update readme 2022-01-06 16:00:13 +00:00
Alif Rachmawadi 523b0faa40 update readme for linux desktop dependencies (closes #49) 2022-01-06 11:45:16 +00:00
Alif Rachmawadi 813937b170 update readme for desktop build (closes #86) 2022-01-06 11:17:49 +00:00
Alif Rachmawadi 8af4ab61aa update readme 2022-01-06 11:12:10 +00:00
Alif Rachmawadi 59a5481c7d fix PUB_CACHE env 2022-01-06 10:46:35 +00:00
Alif Rachmawadi 4686a99fc5 update readme 2022-01-06 09:55:43 +00:00
Alif Rachmawadi 2f01469b02 remove unused files 2022-01-06 09:31:17 +00:00
Alif Rachmawadi f6d2e5de5d update readme 2022-01-06 09:23:09 +00:00
Alif Rachmawadi f5fec4dcb7 remove unused files 2022-01-06 09:22:58 +00:00
Alif Rachmawadi 37e2edb15e add any channel 2022-01-06 09:21:17 +00:00
Alif Rachmawadi c64fa18722 add master channel 2022-01-06 09:05:37 +00:00
Alif Rachmawadi a3bd2fdf17 add version matrix test 2022-01-06 08:57:24 +00:00
Alif Rachmawadi a7e6ec0df9 add PUBCACHE 2022-01-06 08:48:07 +00:00
Alif Rachmawadi 23835ee500 add dart bin to path 2022-01-06 08:45:45 +00:00
Alif Rachmawadi 84b5c35087 download archive 2022-01-06 08:38:04 +00:00
Alif Rachmawadi 365543a8d9 update env name 2022-01-06 07:51:59 +00:00
Alif Rachmawadi 49d7a2a9ae rewrite flutter-action 2022-01-06 07:48:39 +00:00
Alif RachmawadiandGitHub 409aab1aac Merge pull request #119 from subosito/dependabot/npm_and_yarn/ansi-regex-5.0.1
Bump ansi-regex from 5.0.0 to 5.0.1
2021-11-17 15:46:32 +07:00
Alif RachmawadiandGitHub f0c3acec24 Merge pull request #95 from tianhaoz95/fix/update-java-requirements
chore: migrate setup java in the instructions to v2
2021-11-17 15:28:02 +07:00
dependabot[bot]andGitHub 399a47813e Bump ansi-regex from 5.0.0 to 5.0.1
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-17 08:27:53 +00:00
Alif RachmawadiandGitHub 87ca224aa8 Merge pull request #114 from subosito/dependabot/npm_and_yarn/tmpl-1.0.5
Bump tmpl from 1.0.4 to 1.0.5
2021-11-17 15:27:12 +07:00
dependabot[bot]andGitHub a1905c800f Bump tmpl from 1.0.4 to 1.0.5
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-21 11:54:45 +00:00
Alif RachmawadiandGitHub 14cf1a3f11 Merge pull request #111 from subosito/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2021-08-13 16:11:10 +07:00
dependabot[bot]andGitHub 858d2d954a Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-11 08:46:00 +00:00
Alif Rachmawadi 4389e6cbc6 re-use new releases assets url path 2021-06-14 02:47:16 +00:00
Alif RachmawadiandGitHub a471b152dc Merge pull request #97 from subosito/dependabot/npm_and_yarn/ws-7.4.6
Bump ws from 7.4.5 to 7.4.6
2021-06-11 15:33:35 +07:00
dependabot[bot]andGitHub 56a652e69d Bump ws from 7.4.5 to 7.4.6
Bumps [ws](https://github.com/websockets/ws) from 7.4.5 to 7.4.6.
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/7.4.5...7.4.6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-06-11 08:20:48 +00:00
Alif Rachmawadi 8e1e9c4d87 update dist 2021-06-11 08:19:02 +00:00
Alif Rachmawadi 017da32f19 update dependencies 2021-06-11 08:18:38 +00:00
Alif Rachmawadi cb226e935b Back to original path of release assets 2021-06-11 08:13:00 +00:00
Alif RachmawadiandGitHub 5188e41281 Merge pull request #100 from chatsen/master
Fix the endpoint for flutter releases
2021-06-02 10:48:10 +07:00
William BulinandGitHub 1ced41a989 Update index.js 2021-06-02 01:38:26 +02:00
William BulinandGitHub 4ac301c302 Update release.ts 2021-06-02 01:36:53 +02:00
Tianhao ZhouandGitHub 5c3d315241 fix: add missing arguments for java setup 2021-05-17 01:10:08 -07:00
Alif RachmawadiandGitHub 0600af6a5c Merge pull request #93 from subosito/dependabot/npm_and_yarn/hosted-git-info-2.8.9
Bump hosted-git-info from 2.7.1 to 2.8.9
2021-05-15 14:04:20 +07:00
dependabot[bot]andGitHub 1c63d3b831 Bump hosted-git-info from 2.7.1 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.7.1 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.7.1...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-11 01:25:41 +00:00
Alif RachmawadiandGitHub 086f9fb649 Merge pull request #90 from kuhnroyal/feature/pub-cache
Export PUB_CACHE if it is not in env
2021-05-01 08:31:38 +07:00
Peter Leibiger 8f6ad7c383 Export PUB_CACHE if it is not in env
Export `PUB_CACHE` if it is not configured before calling the action.
This ensures that flutter and dart use the same cache.
It also enables other tools to use this official Dart env variable.
2021-04-28 20:43:14 +02:00
Alif Rachmawadi 13141e86c3 update readme 2021-04-26 14:56:05 +00:00
Alif Rachmawadi 41992c08db adjust windows example 2021-04-26 14:49:19 +00:00
Alif RachmawadiandGitHub d94ad8f4a5 Merge pull request #68 from majudhu/patch-1
add example to build for windows
2021-04-26 21:47:15 +07:00
Alif Rachmawadi 7bb7a2ead1 pin prettier 2021-04-26 14:35:27 +00:00
Alif Rachmawadi 08d7837173 update dist 2021-04-26 14:31:40 +00:00
Alif Rachmawadi cb118effe2 update dependencies 2021-04-26 14:30:05 +00:00
Alif Rachmawadi 8c0828b9c2 update readme 2021-04-26 14:24:54 +00:00
Alif Rachmawadi 30d8b6aed2 update tests 2021-04-26 14:24:40 +00:00
Alif RachmawadiandGitHub e7b018ff3a Merge pull request #83 from subosito/dependabot/npm_and_yarn/y18n-4.0.1
Bump y18n from 4.0.0 to 4.0.1
2021-04-02 20:14:32 +07:00
dependabot[bot]andGitHub 267db14c3d Bump y18n from 4.0.0 to 4.0.1
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-30 22:16:18 +00:00
Alif RachmawadiandGitHub 123325ea84 Merge pull request #79 from jpnurmi/pub-cache-path
Add .pub-cache/bin to PATH
2021-03-07 19:03:55 +07:00
J-P Nurmi 06a5370154 Add .pub-cache/bin to PATH 2021-03-05 18:29:25 +01:00
Alif RachmawadiandGitHub 5781588262 Merge pull request #71 from subosito/dependabot/npm_and_yarn/node-notifier-8.0.1
Bump node-notifier from 8.0.0 to 8.0.1
2021-01-07 09:38:37 +07:00
dependabot[bot]andGitHub 2d5af0bae8 Bump node-notifier from 8.0.0 to 8.0.1
Bumps [node-notifier](https://github.com/mikaelbr/node-notifier) from 8.0.0 to 8.0.1.
- [Release notes](https://github.com/mikaelbr/node-notifier/releases)
- [Changelog](https://github.com/mikaelbr/node-notifier/blob/v8.0.1/CHANGELOG.md)
- [Commits](https://github.com/mikaelbr/node-notifier/compare/v8.0.0...v8.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-22 08:02:28 +00:00
Alif Rachmawadi d2a92405ab update examples 2020-12-01 15:49:09 +00:00
Alif Rachmawadi c1329a99f0 fix test 2020-12-01 15:44:22 +00:00
Alif RachmawadiandGitHub 618ffe6e1a Merge pull request #67 from dmitry-shibanov/add-any-channel
Add any channel
2020-12-01 22:08:51 +07:00
MajudhuandGitHub 1b4d6c711f add example to build for windows
add example script which will build a windows executable and also upload it to action artifacts
2020-11-25 14:07:49 +05:00
Dmitry Shibanov 2ed9c88ae0 build project 2020-11-23 16:13:25 +03:00
Dmitry Shibanov d8b5280c4b add any channel 2020-11-23 16:11:57 +03:00
Alif RachmawadiandGitHub 8ffad233a0 Merge pull request #66 from sidrao2006/patch-1
Use FLUTTER_ROOT instead of FLUTTER_HOME
2020-11-21 05:57:49 +07:00
Aneesh RaoandGitHub 2dc29df57b Use FLUTTER_ROOT instead of FLUTTER_HOME 2020-11-19 20:31:28 +05:30
Alif RachmawadiandGitHub d141f1640a Merge pull request #64 from cclauss/patch-1
README.md: actions/checkout@v2
2020-10-20 20:03:42 +07:00
Christian ClaussandGitHub c4e0544d9c fixup! Fix typo 2020-10-20 14:50:34 +02:00
Christian ClaussandGitHub 2ff7205390 README.md: actions/checkout@v2 2020-10-14 12:50:28 +02:00
Alif Rachmawadi 4a44bbb8a6 update dist 2020-10-08 04:42:13 +00:00
Alif Rachmawadi d7578c4eec add support for master channel 2020-10-08 04:36:23 +00:00
Alif Rachmawadi 26bf50084a update test platform map 2020-10-08 01:36:34 +00:00
Alif Rachmawadi 45483e4c19 increase test timeout 2020-10-08 01:32:27 +00:00
Alif Rachmawadi 6f4d1ee832 use exact prettier 2020-10-08 01:26:57 +00:00
Alif Rachmawadi 58a4d54c5d update dist 2020-10-08 01:24:34 +00:00
Alif Rachmawadi d0e7441034 update installer 2020-10-08 01:22:27 +00:00
Alif Rachmawadi c7c0640db8 add release version check function 2020-10-08 01:22:02 +00:00
Alif Rachmawadi 1aaec8dd0f update dependencies 2020-10-08 01:20:47 +00:00
Alif Rachmawadi ddb7b913ca update test data 2020-10-08 01:19:56 +00:00
Alif RachmawadiandGitHub 0b6cdde020 Merge pull request #60 from subosito/dependabot/npm_and_yarn/actions/core-1.2.6
Bump @actions/core from 1.2.4 to 1.2.6
2020-10-07 19:26:56 +07:00
dependabot[bot]andGitHub 8078702ac6 Bump @actions/core from 1.2.4 to 1.2.6
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.4 to 1.2.6.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-01 17:17:20 +00:00
Alif RachmawadiandGitHub 282b38c3d9 Merge pull request #30 from AlessioLuciani/master
Add iOS and Android app bundle builds
2020-08-14 10:12:00 +07:00
Alif RachmawadiandGitHub 12d5ce54d2 Merge pull request #53 from subosito/dependabot/npm_and_yarn/lodash-4.17.19
Bump lodash from 4.17.15 to 4.17.19
2020-07-22 17:03:20 +07:00
dependabot[bot]andGitHub d00139d608 Bump lodash from 4.17.15 to 4.17.19
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-18 00:09:06 +00:00
Alessio LucianiandGitHub 5d4e01ab3b Add build instructions for the web 2020-06-19 16:13:08 +02:00
Alif Rachmawadi 40bc2f6940 bump version 2020-05-09 11:03:06 +07:00
Alif Rachmawadi f0d790518f update dist 2020-05-09 10:37:01 +07:00
Alif Rachmawadi c4a41752bd update dependencies 2020-05-09 10:36:22 +07:00
Alif Rachmawadi 929035d687 update test 2020-05-09 10:17:16 +07:00
Alif Rachmawadi 4bb529986f use channel for latest release 2020-05-09 09:46:10 +07:00
Alif Rachmawadi ecb8eabe6f update tests 2020-05-09 09:43:40 +07:00
Alif Rachmawadi cf426f9aa2 update release manifest 2020-05-09 09:43:05 +07:00
Alif Rachmawadi 794e42ad48 bump version: 1.3.1 2020-04-30 09:48:20 +07:00
Alif Rachmawadi 2dd537cc3f update dist 2020-04-30 09:47:38 +07:00
Alif RachmawadiandGitHub 3ba093556e Merge pull request #36 from subosito/dependabot/npm_and_yarn/actions/http-client-1.0.8
Bump @actions/http-client from 1.0.7 to 1.0.8
2020-04-30 09:45:20 +07:00
dependabot[bot]andGitHub 9cde868c41 Bump @actions/http-client from 1.0.7 to 1.0.8
Bumps [@actions/http-client](https://github.com/actions/http-client) from 1.0.7 to 1.0.8.
- [Release notes](https://github.com/actions/http-client/releases)
- [Changelog](https://github.com/actions/http-client/blob/master/RELEASES.md)
- [Commits](https://github.com/actions/http-client/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2020-04-29 18:01:31 +00:00
Alif Rachmawadi c1bf65eb31 add dart usage example 2020-04-14 02:34:44 +00:00
Alif Rachmawadi cfb544479d use previous prettier 2020-04-14 02:31:17 +00:00
Alif Rachmawadi c256877acc bump version 2020-04-14 02:20:56 +00:00
Alif Rachmawadi 5c02dc7f05 update dist 2020-04-14 02:19:57 +00:00
Alif Rachmawadi 4d34db08ae update dependencies 2020-04-14 02:19:33 +00:00
Alif Rachmawadi b4d02d2183 update test duration 2020-04-14 02:05:13 +00:00
Alif Rachmawadi 713f696c59 update test 2020-04-14 01:47:20 +00:00
Alif Rachmawadi c8f591812e update dist 2020-04-14 01:17:42 +00:00
Alif Rachmawadi f7a5d4550a handle new release format 2020-04-14 01:14:56 +00:00
Alif Rachmawadi 19074769c8 add test for new release format 2020-04-14 01:14:55 +00:00
Alif Rachmawadi 1b5073106b update releases data 2020-04-14 01:14:55 +00:00
Alif Rachmawadi a8119581ff npm audit fix 2020-04-14 01:14:54 +00:00
Alif RachmawadiandGitHub 0ee5f96289 Merge pull request #33 from tianhaoz95/patch-2
might be interesting to add dart SDK to path
2020-04-14 07:57:34 +07:00
Tianhao ZhouandGitHub 9d3762c82e fix: use join to comply with other os 2020-04-13 14:41:49 -07:00
Tianhao ZhouandGitHub 6ebddd1b83 fix: add the missing bin directory in dart sdk 2020-04-11 18:23:34 -07:00
Tianhao ZhouandGitHub a79364fc11 dev: add dart sdk to path
Adding Flutter bin to the path doesn't expose the dart SDK which many people might be interested in using. For example, dartdoc for documentation generation.
2020-04-11 18:10:01 -07:00
Alessio LucianiandGitHub a81c830097 Add iOS and Android app bundle builds
Solving issue https://github.com/subosito/flutter-action/issues/7 .
2020-04-09 14:40:15 +02:00
Alif Rachmawadi f4209dc839 force minimist resolution 2020-03-17 09:38:25 +07:00
Alif Rachmawadi cf2fb6cf42 update depedencies 2020-03-17 09:06:14 +07:00
Alif Rachmawadi 8828996b00 fix acorn vulnerabilities 2020-03-17 09:00:22 +07:00
20 changed files with 12744 additions and 17977 deletions
+105 -14
View File
@@ -1,22 +1,113 @@
name: Main workflow
on: [push]
on:
push:
branches:
- main
pull_request:
paths:
- setup.sh
- action.yml
jobs:
run:
name: Run
lint_shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ludeeus/action-shellcheck@master
test_channel:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
channel: [stable, beta, master]
steps:
- uses: actions/checkout@v3
- uses: ./
with:
channel: ${{ matrix.channel }}
- run: dart --version
shell: bash
- run: flutter --version
shell: bash
test_cache:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Node.js 10.x
uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: ./
with:
node-version: 10.x
- name: npm install
run: npm install
- name: Lint
run: npm run format-check
- name: npm test
run: npm test
channel: stable
cache: true
- run: dart --version
shell: bash
- run: flutter --version
shell: bash
test_version:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: ./setup.sh -p version | grep -x 'stable:any:x64|stable:3.0.5:x64'
shell: bash
- run: ./setup.sh -p version stable | grep -x 'stable:any:x64|stable:3.0.5:x64'
shell: bash
- run: ./setup.sh -p version beta | grep -x 'beta:any:x64|beta:3.1.0-9.0.pre:x64'
shell: bash
- run: ./setup.sh -p version master | grep -x 'master:master:x64|master:master:x64'
shell: bash
- run: ./setup.sh -p version stable 2 | grep -x 'stable:2:x64|stable:2.10.5:x64'
shell: bash
- run: ./setup.sh -p version beta 2 | grep -x 'beta:2:x64|beta:2.13.0-0.4.pre:x64'
shell: bash
- run: ./setup.sh -p version any 2 | grep -x 'any:2:x64|beta:2.13.0-0.4.pre:x64'
shell: bash
- run: ./setup.sh -p version any 3 | grep -x 'any:3:x64|stable:3.0.5:x64'
shell: bash
- run: ./setup.sh -p version any 3 arm64 | grep -x 'any:3:arm64|stable:3.0.5:arm64'
shell: bash
- run: ./setup.sh -p version stable any arm64 | grep -x 'stable:any:arm64|stable:3.0.5:arm64'
shell: bash
- run: ./setup.sh -p version stable 1 | grep -x 'stable:1:x64|stable:1.22.6:x64'
shell: bash
- run: ./setup.sh -p version stable v1 | grep -x 'stable:v1:x64|stable:v1.12.13+hotfix.9:x64'
shell: bash
- run: ./setup.sh -p version any 0 | grep -x 'any:0:x64|beta:v0.11.13:x64'
shell: bash
- run: ./setup.sh -p version any v0 | grep -x 'any:v0:x64|beta:v0.11.13:x64'
shell: bash
test_cache_key:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: ./setup.sh -p cache-key | grep -x 'flutter-macos-x64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key stable | grep -x 'flutter-macos-x64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key beta | grep -x 'flutter-macos-x64-beta-3.1.0-9.0.pre-f28e570c8cb12a004fae2d796d0d9cd46603bde9'
shell: bash
- run: ./setup.sh -p cache-key master | grep -x 'flutter-macos-x64-master-master-master'
shell: bash
- run: ./setup.sh -p cache-key stable 2 | grep -x 'flutter-macos-x64-stable-2.10.5-5464c5bac742001448fe4fc0597be939379f88ea'
shell: bash
- run: ./setup.sh -p cache-key beta 2 | grep -x 'flutter-macos-x64-beta-2.13.0-0.4.pre-25caf1461b8f643092a9f6f5b224453b5c057d10'
shell: bash
- run: ./setup.sh -p cache-key any 2 | grep -x 'flutter-macos-x64-beta-2.13.0-0.4.pre-25caf1461b8f643092a9f6f5b224453b5c057d10'
shell: bash
- run: ./setup.sh -p cache-key any 3 | grep -x 'flutter-macos-x64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key any 3 arm64 | grep -x 'flutter-macos-arm64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key stable any arm64 | grep -x 'flutter-macos-arm64-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key stable 1 | grep -x 'flutter-macos-x64-stable-1.22.6-9b2d32b605630f28625709ebd9d78ab3016b2bf6'
shell: bash
- run: ./setup.sh -p cache-key stable v1 | grep -x 'flutter-macos-x64-stable-v1.12.13+hotfix.9-f139b11009aeb8ed2a3a3aa8b0066e482709dde3'
shell: bash
- run: ./setup.sh -p cache-key any 0 | grep -x 'flutter-macos-x64-beta-v0.11.13-58c8489fcdb4e4ef6c010117584c9b23d15221aa'
shell: bash
- run: ./setup.sh -p cache-key any v0 | grep -x 'flutter-macos-x64-beta-v0.11.13-58c8489fcdb4e4ef6c010117584c9b23d15221aa'
shell: bash
- run: ./setup.sh -p cache-key -k 'custom-:channel:-:version:-:hash:' | grep -x 'custom-stable-3.0.5-f1875d570e39de09040c8f79aa13cc56baab8db1'
shell: bash
- run: ./setup.sh -p cache-key -k 'custom-:channel:-:version:-:sha256:' | grep -x 'custom-stable-3.0.5-e79a04dcfd1b583e5831433fc200800ba0d1e9fe4567cb661479bd2542d4c685'
shell: bash
-3
View File
@@ -1,3 +0,0 @@
node_modules/
lib/
__tests__/runner/*
-11
View File
@@ -1,11 +0,0 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
"arrowParens": "avoid",
"parser": "typescript"
}
+140 -44
View File
@@ -1,77 +1,173 @@
# flutter-action
This action sets up a flutter environment for use in actions. It works on Linux, Windows, and macOS.
Flutter environment for use in GitHub Actions. It works on Linux, Windows, and macOS.
# Usage
## Usage
Use specific version and channel:
```yaml
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
flutter-version: '1.9.1+hotfix.6'
- run: flutter pub get
- run: flutter test
- run: flutter build apk
flutter-version: '3.0.5'
channel: 'stable'
- run: flutter --version
```
Use latest release for particular channel:
```yaml
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
channel: 'stable' # or: 'dev' or 'beta'
- run: flutter pub get
- run: flutter test
- run: flutter build apk
channel: 'stable' # or: 'beta' or 'master'
- run: flutter --version
```
Use latest release for particular version and/or channel:
```yaml
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
flutter-version: '1.22.x' # or, you can use 1.22
channel: 'dev'
- run: flutter --version
```
Use particular version on any channel:
```yaml
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '1.12.x' # you can use 1.12
channel: 'dev' # optional, default to: 'stable'
flutter-version: '2.x'
channel: 'any'
- run: flutter --version
```
Build Android APK and app bundle:
```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.0.5'
- run: flutter pub get
- run: flutter test
- run: flutter build apk
- run: flutter build appbundle
```
Matrix Testing:
Build for iOS (macOS only):
```yaml
jobs:
test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- uses: subosito/flutter-action@v1
with:
flutter-version: '1.11.0'
channel: 'beta'
- run: flutter pub get
- run: flutter test
- run: flutter build apk
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
architecture: x64
- run: flutter pub get
- run: flutter test
- run: flutter build ios --release --no-codesign
```
Build for the web:
```yaml
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter build web
```
Build for Windows:
```yaml
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: 'beta'
- run: flutter config --enable-windows-desktop
- run: flutter build windows
```
Build for Linux desktop:
```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- run: flutter config --enable-linux-desktop
- run: flutter build linux
```
Build for macOS desktop:
```yaml
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
architecture: x64
- run: flutter config --enable-macos-desktop
- run: flutter build macos
```
Integration with `actions/cache`:
```yaml
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:arch:-:channel:-:version:-:hash:' # optional, change this to force refresh cache
cache-path: ${{ runner.tool_cache }}/flutter # optional, change this to specify the cache path
architecture: x64 # optional, x64 or arm64
- run: flutter --version
```
Note: `cache-key` has support for several dynamic values:
- `:os:`
- `:arch:`
- `:channel:`
- `:version:`
- `:hash:`
- `:sha256:`
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-109
View File
@@ -1,109 +0,0 @@
import io = require('@actions/io');
import fs = require('fs');
import path = require('path');
import nock = require('nock');
const toolDir = path.join(__dirname, 'runner', 'tools');
const tempDir = path.join(__dirname, 'runner', 'temp');
const dataDir = path.join(__dirname, 'data');
process.env['RUNNER_TOOL_CACHE'] = toolDir;
process.env['RUNNER_TEMP'] = tempDir;
import * as installer from '../src/installer';
function osName(): string {
switch (process.platform) {
case 'win32':
return 'windows';
case 'darwin':
return 'macos';
default:
return process.platform;
}
}
describe('installer tests', () => {
beforeAll(async () => {
await io.rmRF(toolDir);
await io.rmRF(tempDir);
}, 300000);
afterAll(async () => {
try {
await io.rmRF(toolDir);
await io.rmRF(tempDir);
} catch {
console.log('Failed to remove test directories');
}
}, 100000);
it('Downloads flutter', async () => {
await installer.getFlutter('1.0.0', 'stable');
const sdkDir = path.join(toolDir, 'flutter', '1.0.0-stable', 'x64');
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
}, 100000);
it('Downloads flutter from beta channel', async () => {
await installer.getFlutter('1.8.3', 'beta');
const sdkDir = path.join(toolDir, 'flutter', '1.8.3-beta', 'x64');
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
}, 100000);
describe('get the latest release of a flutter version', () => {
beforeEach(() => {
const platform = osName();
nock('https://storage.googleapis.com', {allowUnmocked: true})
.get(`/flutter_infra/releases/releases_${platform}.json`)
.replyWithFile(200, path.join(dataDir, `releases_${platform}.json`));
});
afterEach(() => {
nock.cleanAll();
nock.enableNetConnect();
});
it('Downloads latest flutter release from stable channel', async () => {
await installer.getFlutter('', 'stable');
const sdkDir = path.join(
toolDir,
'flutter',
'1.7.8-hotfix.4-stable',
'x64'
);
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
}, 200000);
it('Downloads latest flutter release of 1.7 when using version 1.7 from dev channel', async () => {
await installer.getFlutter('1.7', 'dev');
const sdkDir = path.join(toolDir, 'flutter', '1.7.11-dev', 'x64');
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
}, 200000);
it('Downloads latest flutter release of 1.7 when using version 1.7.x from dev channel', async () => {
await installer.getFlutter('1.7.x', 'dev');
const sdkDir = path.join(toolDir, 'flutter', '1.7.11-dev', 'x64');
expect(fs.existsSync(`${sdkDir}.complete`)).toBe(true);
expect(fs.existsSync(path.join(sdkDir, 'bin'))).toBe(true);
}, 200000);
});
it('Throws if no location contains correct flutter version', async () => {
let thrown = false;
try {
await installer.getFlutter('1000.0', 'dev');
} catch {
thrown = true;
}
expect(thrown).toBe(true);
});
});
+32 -5
View File
@@ -1,17 +1,44 @@
name: 'Flutter action'
description: 'Setup your runner with Flutter environment'
author: 'Alif Rachmawadi'
branding:
icon: 'maximize'
color: 'blue'
inputs:
flutter-version:
description: 'The Flutter version to make available on the path'
required: false
default: 'any'
channel:
description: 'The Flutter build release channel'
required: false
default: 'stable'
cache:
description: 'Cache the Flutter SDK'
required: false
cache-key:
description: 'Identifier for the Flutter SDK cache'
required: false
default: 'flutter-:os:-:arch:-:channel:-:version:-:hash:'
cache-path:
description: 'Flutter SDK cache path'
required: false
default: ${{ runner.tool_cache }}/flutter
architecture:
description: 'The architecture of Flutter SDK executable (x64 or arm64)'
required: false
default: ${{ runner.arch }}
runs:
using: 'node12'
main: 'dist/index.js'
branding:
icon: 'maximize'
color: 'blue'
using: 'composite'
steps:
- if: ${{ inputs.cache == 'true' }}
id: flutter-action-cache-key-builder
run: echo "::set-output name=cache-key::$($GITHUB_ACTION_PATH/setup.sh -p cache-key -k ${{ inputs.cache-key }} ${{ inputs.channel }} ${{ inputs.flutter-version }} ${{ inputs.architecture }})"
shell: bash
- if: ${{ inputs.cache == 'true' }}
uses: actions/cache@v3
with:
path: ${{ inputs.cache-path }}
key: ${{ steps.flutter-action-cache-key-builder.outputs.cache-key }}
- run: $GITHUB_ACTION_PATH/setup.sh -c "${{ inputs.cache-path }}" ${{ inputs.channel }} ${{ inputs.flutter-version }} ${{ inputs.architecture }}
shell: bash
-6718
View File
File diff suppressed because it is too large Load Diff
-11
View File
@@ -1,11 +0,0 @@
module.exports = {
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
verbose: true
}
-6232
View File
File diff suppressed because it is too large Load Diff
-51
View File
@@ -1,51 +0,0 @@
{
"name": "flutter-action",
"version": "1.2.0",
"private": true,
"description": "Flutter environment for use in actions",
"main": "lib/index.js",
"scripts": {
"build-tsc": "tsc",
"build-ncc": "ncc build",
"build": "run-s build-tsc build-ncc",
"format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts",
"test": "jest"
},
"repository": {
"type": "git",
"url": "git+https://github.com/subosito/flutter-action.git"
},
"keywords": [
"actions",
"node",
"flutter",
"setup"
],
"author": "Alif Rachmawadi <arch@subosito.com>",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.3",
"@actions/exec": "^1.0.3",
"@actions/http-client": "^1.0.6",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^1.3.1",
"semver": "^7.1.3",
"uuid": "^7.0.1"
},
"devDependencies": {
"@types/jest": "^25.1.3",
"@types/nock": "^10.0.3",
"@types/node": "^12.12.29",
"@types/semver": "^7.1.0",
"@types/uuid": "^7.0.0",
"@zeit/ncc": "^0.21.1",
"jest": "^25.1.0",
"jest-circus": "^25.1.0",
"nock": "^10.0.6",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"ts-jest": "^25.2.1",
"typescript": "^3.8.3"
}
}
Executable
+233
View File
@@ -0,0 +1,233 @@
#!/bin/bash
check_command() {
command -v "$1" >/dev/null 2>&1
}
if ! check_command jq; then
echo "jq not found, please install it, https://stedolan.github.io/jq/download/"
exit 1
fi
OS_NAME=$(echo "$RUNNER_OS" | awk '{print tolower($0)}')
MANIFEST_BASE_URL="https://storage.googleapis.com/flutter_infra_release/releases"
MANIFEST_URL="$MANIFEST_BASE_URL/releases_$OS_NAME.json"
MANIFEST_TEST_FIXTURE="test/releases_$OS_NAME.json"
legacy_wildcard_version() {
if [[ $1 == any ]]; then
jq --arg version "$2" '.releases | map(select(.version | startswith($version) )) | first'
else
jq --arg channel "$1" --arg version "$2" '.releases | map(select(.channel==$channel) | select(.version | startswith($version) )) | first'
fi
}
wildcard_version() {
if [[ $1 == any ]]; then
jq --arg version "$2" --arg arch "$3" '.releases | map(select(.version | startswith($version)) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
else
jq --arg channel "$1" --arg version "$2" --arg arch "$3" '.releases | map(select(.channel==$channel) | select(.version | startswith($version) ) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
fi
}
get_version() {
if [[ "$1" == any && "$2" == any ]]; then # latest_version
jq --arg arch "$3" '.releases | map(select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
elif [[ "$2" == any ]]; then # latest channel version
jq --arg channel "$1" --arg arch "$3" '.releases | map(select(.channel==$channel) | select(.dart_sdk_arch == null or .dart_sdk_arch == $arch)) | first'
else
wildcard_version "$1" "$2" "$3"
fi
}
normalize_version() {
if [[ "$1" == *.x ]]; then
echo "${1/.x/}"
else
echo "$1"
fi
}
not_found_error() {
echo "Unable to determine Flutter version for channel: $1 version: $2 architecture: $3"
}
transform_path() {
if [[ "$OS_NAME" == windows ]]; then
echo "$1" | sed -e 's/^\///' -e 's/\//\\/g'
else
echo "$1"
fi
}
download_archive() {
archive_url="$MANIFEST_BASE_URL/$1"
archive_name=$(basename "$1")
archive_local="$RUNNER_TEMP/$archive_name"
curl --connect-timeout 15 --retry 5 "$archive_url" >"$archive_local"
# Create the target folder
mkdir -p "$2"
if [[ "$archive_name" == *zip ]]; then
unzip -q -o "$archive_local" -d "$RUNNER_TEMP"
# Remove the folder again so that the move command can do a simple rename
# instead of moving the content into the target folder.
# This is a little bit of a hack since the "mv --no-target-directory"
# linux option is not available here
rm -r "$2"
mv "$RUNNER_TEMP"/flutter "$2"
else
tar xf "$archive_local" -C "$2" --strip-components=1
fi
rm "$archive_local"
}
CACHE_PATH=""
CACHE_KEY=""
PRINT_MODE=""
while getopts 'c:k:p:' flag; do
case "$flag" in
c) CACHE_PATH="$OPTARG" ;;
k) CACHE_KEY="$OPTARG" ;;
p) PRINT_MODE="$OPTARG" ;;
?) exit 2 ;;
esac
done
ARR_CHANNEL=("${@:$OPTIND:1}")
ARR_VERSION=("${@:$OPTIND+1:1}")
ARR_ARCH=("${@:$OPTIND+2:1}")
CHANNEL="${ARR_CHANNEL[0]}"
VERSION="${ARR_VERSION[0]}"
ARCH=$(echo "${ARR_ARCH[0]}" | awk '{print tolower($0)}')
[[ -z $CHANNEL ]] && CHANNEL=stable
[[ -z $VERSION ]] && VERSION=any
[[ -z $ARCH ]] && ARCH=x64
[[ -z $CACHE_PATH ]] && CACHE_PATH=/tmp
[[ -z $CACHE_KEY ]] && CACHE_KEY="flutter-:os:-:arch:-:channel:-:version:-:hash:"
RELEASE_MANIFEST=""
VERSION_MANIFEST=""
get_version_manifest() {
version_normalized=$(normalize_version "$VERSION")
version_manifest=$(echo "$RELEASE_MANIFEST" | get_version "$CHANNEL" "$version_normalized" "$ARCH")
if [[ "$version_manifest" == null ]]; then
version_manifest=$(echo "$RELEASE_MANIFEST" | legacy_wildcard_version "$CHANNEL" "v$version_normalized")
fi
version_arch=$(echo "$version_manifest" | jq -r '.dart_sdk_arch')
if [[ "$version_arch" == null ]]; then
if [[ "$ARCH" == x64 ]]; then
echo "$version_manifest" | jq --arg dart_sdk_arch x64 '.+={dart_sdk_arch:$dart_sdk_arch}'
else
echo ""
fi
else
echo "$version_manifest"
fi
}
expand_key() {
version_channel=$(echo "$VERSION_MANIFEST" | jq -r '.channel')
version_version=$(echo "$VERSION_MANIFEST" | jq -r '.version')
version_arch=$(echo "$VERSION_MANIFEST" | jq -r '.dart_sdk_arch')
version_hash=$(echo "$VERSION_MANIFEST" | jq -r '.hash')
version_sha_256=$(echo "$VERSION_MANIFEST" | jq -r '.sha256')
expanded_key="${1/:channel:/$version_channel}"
expanded_key="${expanded_key/:version:/$version_version}"
expanded_key="${expanded_key/:arch:/$version_arch}"
expanded_key="${expanded_key/:hash:/$version_hash}"
expanded_key="${expanded_key/:sha256:/$version_sha_256}"
expanded_key="${expanded_key/:os:/$OS_NAME}"
echo "$expanded_key"
}
print_version() {
version_debug=$(echo "$VERSION_MANIFEST" | jq -j '.channel,":",.version,":",.dart_sdk_arch')
echo "$CHANNEL:$VERSION:$ARCH|$version_debug"
}
if [[ -n "$PRINT_MODE" ]]; then
if [[ "$CHANNEL" == master ]]; then
if [[ "$PRINT_MODE" == version ]]; then
echo "master:master:$ARCH|master:master:$ARCH"
exit 0
fi
if [[ "$PRINT_MODE" == cache-key ]]; then
VERSION_MANIFEST="{\"channel\":\"$CHANNEL\",\"version\":\"$CHANNEL\",\"dart_sdk_arch\":\"$ARCH\",\"hash\":\"$CHANNEL\",\"sha256\":\"$CHANNEL\"}"
EXPANDED_KEY=$(expand_key "$CACHE_KEY")
echo "$EXPANDED_KEY"
exit 0
fi
exit 1
fi
RELEASE_MANIFEST=$(cat "$MANIFEST_TEST_FIXTURE")
VERSION_MANIFEST=$(get_version_manifest)
if [[ -z "$VERSION_MANIFEST" ]]; then
not_found_error "$CHANNEL" "$VERSION" "$ARCH"
exit 1
fi
if [[ "$PRINT_MODE" == version ]]; then
print_version
exit 0
fi
if [[ "$PRINT_MODE" == cache-key ]]; then
EXPANDED_KEY=$(expand_key "$CACHE_KEY")
echo "$EXPANDED_KEY"
exit 0
fi
exit 1
fi
CACHE_PATH=$(transform_path "$CACHE_PATH")
SDK_CACHE=$(expand_key "$CACHE_PATH")
PUB_CACHE=$(expand_key "$SDK_CACHE/.pub-cache")
if [[ ! -x "$SDK_CACHE/bin/flutter" ]]; then
if [[ $CHANNEL == master ]]; then
git clone -b master https://github.com/flutter/flutter.git "$SDK_CACHE"
else
RELEASE_MANIFEST=$(curl --silent --connect-timeout 15 --retry 5 "$MANIFEST_URL")
VERSION_MANIFEST=$(get_version_manifest)
if [[ -z "$VERSION_MANIFEST" ]]; then
not_found_error "$CHANNEL" "$VERSION" "$ARCH"
exit 1
fi
ARCHIVE_PATH=$(echo "$VERSION_MANIFEST" | jq -r '.archive')
download_archive "$ARCHIVE_PATH" "$SDK_CACHE"
print_version
fi
fi
{
echo "FLUTTER_ROOT=$SDK_CACHE"
echo "PUB_CACHE=$PUB_CACHE"
} >>"$GITHUB_ENV"
{
echo "$SDK_CACHE/bin"
echo "$SDK_CACHE/bin/cache/dart-sdk/bin"
echo "$PUB_CACHE/bin"
} >>"$GITHUB_PATH"
-15
View File
@@ -1,15 +0,0 @@
import * as core from '@actions/core';
import * as installer from './installer';
async function run() {
try {
const version = core.getInput('flutter-version') || '';
const channel = core.getInput('channel') || 'stable';
await installer.getFlutter(version, channel);
} catch (error) {
core.setFailed(error.message);
}
}
run();
-211
View File
@@ -1,211 +0,0 @@
import * as core from '@actions/core';
import * as io from '@actions/io';
import * as tc from '@actions/tool-cache';
import * as fs from 'fs';
import * as path from 'path';
import * as httpm from '@actions/http-client';
import * as semver from 'semver';
const IS_WINDOWS = process.platform === 'win32';
const IS_DARWIN = process.platform === 'darwin';
const IS_LINUX = process.platform === 'linux';
const storageUrl = 'https://storage.googleapis.com/flutter_infra/releases';
let tempDirectory = process.env['RUNNER_TEMP'] || '';
if (!tempDirectory) {
let baseLocation;
if (IS_WINDOWS) {
baseLocation = process.env['USERPROFILE'] || 'C:\\';
} else {
if (process.platform === 'darwin') {
baseLocation = '/Users';
} else {
baseLocation = '/home';
}
}
tempDirectory = path.join(baseLocation, 'actions', 'temp');
}
export async function getFlutter(
version: string,
channel: string
): Promise<void> {
const versionPart = version.split('.');
if (versionPart[1] == null || versionPart[2] == null) {
version = version.concat('.x');
}
version = await determineVersion(version, channel);
let cleanver = `${version.replace('+', '-')}-${channel}`;
let toolPath = tc.find('flutter', cleanver);
if (toolPath) {
core.debug(`Tool found in cache ${toolPath}`);
} else {
core.debug('Downloading Flutter from Google storage');
const downloadInfo = getDownloadInfo(version, channel);
const sdkFile = await tc.downloadTool(downloadInfo.url);
let tempDir: string = generateTempDir();
const sdkDir = await extractDownload(sdkFile, tempDir);
core.debug(`Flutter sdk extracted to ${sdkDir}`);
toolPath = await tc.cacheDir(sdkDir, 'flutter', cleanver);
}
core.exportVariable('FLUTTER_HOME', toolPath);
core.addPath(path.join(toolPath, 'bin'));
}
function osName(): string {
if (IS_DARWIN) return 'macos';
if (IS_WINDOWS) return 'windows';
return process.platform;
}
function extName(): string {
if (IS_LINUX) return 'tar.xz';
return 'zip';
}
function getDownloadInfo(
version: string,
channel: string
): {version: string; url: string} {
const os = osName();
const ext = extName();
const url = `${storageUrl}/${channel}/${os}/flutter_${os}_v${version}-${channel}.${ext}`;
return {
version,
url
};
}
function generateTempDir(): string {
return path.join(
tempDirectory,
'temp_' + Math.floor(Math.random() * 2000000000)
);
}
async function extractDownload(
sdkFile: string,
destDir: string
): Promise<string> {
await io.mkdirP(destDir);
const sdkPath = path.normalize(sdkFile);
const stats = fs.statSync(sdkPath);
if (stats.isFile()) {
await extractFile(sdkFile, destDir);
const sdkDir = path.join(destDir, fs.readdirSync(destDir)[0]);
return sdkDir;
} else {
throw new Error(`Flutter sdk argument ${sdkFile} is not a file`);
}
}
async function extractFile(file: string, destDir: string): Promise<void> {
const stats = fs.statSync(file);
if (!stats) {
throw new Error(`Failed to extract ${file} - it doesn't exist`);
} else if (stats.isDirectory()) {
throw new Error(`Failed to extract ${file} - it is a directory`);
}
if ('tar.xz' === extName()) {
await tc.extractTar(file, destDir, 'x');
} else {
await tc.extractZip(file, destDir);
}
}
async function determineVersion(
version: string,
channel: string
): Promise<string> {
if (version.endsWith('.x') || version === '') {
return await getLatestVersion(version, channel);
}
return version;
}
interface IFlutterChannel {
[key: string]: string;
beta: string;
dev: string;
stable: string;
}
interface IFlutterRelease {
hash: string;
channel: string;
version: string;
}
interface IFlutterStorage {
current_release: IFlutterChannel;
releases: IFlutterRelease[];
}
async function getLatestVersion(
version: string,
channel: string
): Promise<string> {
const releasesUrl: string = `${storageUrl}/releases_${osName()}.json`;
const http: httpm.HttpClient = new httpm.HttpClient('flutter-action');
const storage: IFlutterStorage | null = (
await http.getJson<IFlutterStorage | null>(releasesUrl)
).result;
if (!storage) {
throw new Error('unable to get latest version');
}
if (version.endsWith('.x')) {
const sver = version.slice(0, version.length - 2);
const releases = storage.releases.filter(
release =>
release.version.startsWith(`v${sver}`) && release.channel === channel
);
const versions = releases.map(release =>
release.version.slice(1, release.version.length)
);
const sortedVersions = versions.sort(semver.rcompare);
core.debug(
`latest version of ${version} from channel ${channel} is ${sortedVersions[0]}`
);
return sortedVersions[0];
}
const channelVersion = storage.releases.find(
release => release.hash === storage.current_release[channel]
);
if (!channelVersion) {
throw new Error(`unable to get latest version from channel ${channel}`);
}
let cver = channelVersion.version;
cver = cver.slice(1, cver.length);
core.debug(`latest version from channel ${channel} is ${cver}`);
return cver;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
-11
View File
@@ -1,11 +0,0 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"outDir": "./lib",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true
},
"exclude": ["node_modules", "**/*.test.ts"]
}