Compare commits

..
102 Commits
Author SHA1 Message Date
Cedric van Putten 1b57c37e9b docs: add commands to contirbuting guide for updating v{major} tags 2021-06-17 14:13:56 +02:00
Cedric van Putten 76ce4de80e docs: update upstream reference in contributing guide 2021-06-17 14:11:07 +02:00
semantic-release-bot a888e4f311 chore: create new release 5.5.1
### [5.5.1](https://github.com/expo/expo-github-action/compare/5.5.0...5.5.1) (2021-06-17)

### Bug fixes

* revert to node 12 for the action ([2662a5f](https://github.com/expo/expo-github-action/commit/2662a5f0dec42d7a9c66b55f8ce937f37aaac9b4))
2021-06-17 12:00:20 +00:00
Cedric van Putten 2662a5f0de fix: revert to node 12 for the action 2021-06-17 13:58:51 +02:00
semantic-release-bot d4dc05e178 chore: create new release 5.5.0
## [5.5.0](https://github.com/expo/expo-github-action/compare/5.4.0...5.5.0) (2021-06-17)

### New features

* switch to node 14 for the action itself ([f13b0ea](https://github.com/expo/expo-github-action/commit/f13b0ea032efcf2e6689743879af6b3e1c72201d))

### Bug fixes

* add support for environments without remote cache ([#91](https://github.com/expo/expo-github-action/issues/91)) ([9c0e696](https://github.com/expo/expo-github-action/commit/9c0e6962510d4e08c6429cac42f624c563675ee1))

### Code changes

* simplify typescript config with community config ([#94](https://github.com/expo/expo-github-action/issues/94)) ([da4e754](https://github.com/expo/expo-github-action/commit/da4e75428b7c5ffd16e8b2c698f590313c741621))
* update all dependencies to latest versions ([#93](https://github.com/expo/expo-github-action/issues/93)) ([6bc0bed](https://github.com/expo/expo-github-action/commit/6bc0bedbc75bb0d6743e4accf032cd01348d6775))

### Other chores

* add semantic release for easy versioning ([#95](https://github.com/expo/expo-github-action/issues/95)) ([6354b0a](https://github.com/expo/expo-github-action/commit/6354b0a0477a72375cee808d8a5b6006d6e86e77))
* fix the allowed branches for semenatic release ([6b8c488](https://github.com/expo/expo-github-action/commit/6b8c488fd6239c9a76d7f95355a58bc8b2a20ac4))
* mock the github actions warning to avoid leaking annotations ([#96](https://github.com/expo/expo-github-action/issues/96)) ([a11a47a](https://github.com/expo/expo-github-action/commit/a11a47a3e8735a206eed196499604322b0bdc877))
* tweak the release workflow ([79ebfbc](https://github.com/expo/expo-github-action/commit/79ebfbc3b83497f443fd65eb5bd33484e5519f64))

### Documentation changes

* add missing release step to contributing guide ([04e3b32](https://github.com/expo/expo-github-action/commit/04e3b32e94e3abe9cd65d37c57a0cead55186970))
2021-06-17 11:56:00 +00:00
Cedric van Putten 04e3b32e94 docs: add missing release step to contributing guide 2021-06-17 13:48:41 +02:00
Cedric van Putten a11a47a3e8 chore: mock the github actions warning to avoid leaking annotations (#96) 2021-06-17 13:45:18 +02:00
Cedric van Putten 79ebfbc3b8 chore: tweak the release workflow
It should be able to publish from master and main, plus checks if the build is up to date
2021-06-17 13:36:09 +02:00
Cedric van Putten 6b8c488fd6 chore: fix the allowed branches for semenatic release 2021-06-17 13:30:48 +02:00
Cedric van Putten f13b0ea032 feature: switch to node 14 for the action itself
Although this isn't a big feature, it does include new features from Node.
2021-06-17 13:27:07 +02:00
Cedric van Putten 6354b0a047 chore: add semantic release for easy versioning (#95)
* chore: add semantic release for easy versioning

* chore: add workflow to release a new version

* docs: add contributing guide for developers
2021-06-17 13:22:35 +02:00
Cedric van Putten da4e75428b refactor: simplify typescript config with community config (#94) 2021-06-17 13:05:01 +02:00
Cedric van Putten 6bc0bedbc7 refactor: update all dependencies to latest versions (#93)
* refactor: update actions cache to 1.0.7

- Make caching more verbose
- Use GNU tar on macOS if available
- Fixes permissions issue extracting archives with GNU tar on macOS

* refactor: update actions core to 1.4.0

- Prepend newline for set-output
- Added the getBooleanInput function
- Added the trimWhitespace option to getInput
- Added the getMultilineInput function

* refactor: update actions exec to 1.1.0

- Better error for bad cwd
- Add getExecOutput function
- Fix stdline dropping large output

* refactor: update actions io to 1.1.1

- Add findInPath method to locate all matching executables in the system path
- Fixed a bug where we incorrectly escaped paths for rmrf

* refactor: update actions tool-cache to 1.7.1

- Force overwrite on default when extracted compressed files
- Export isExplicitVersion and evaluateVersions functions
- Allow arbirtary headers when downloading tools to the tc
- Update to latest @actions/io verison
- Fallback to os-releases file to get linux version

* refactor: update jest to 27

* refactor: update node types to 14.17.3

* refactor: update semver and types to latest version

* refactor: update typescript to latest version

* refactor: update eslint to latest version

* refactor: update husky to 6.0.0

* chore: rebuild yarn lockfile and build files
2021-06-17 12:51:22 +02:00
Cedric van Putten 9c0e696251 fix: add support for environments without remote cache (#91) 2021-06-17 00:48:00 +02:00
Cedric van Putten 8275e8fa89 chore: release version 5.4.0 2021-01-12 15:20:04 +01:00
Cedric van Putten 4ec7251759 chore: update all dependencies to latest versions (#78) 2021-01-12 14:43:14 +01:00
Cedric van Putten 6c0f4d78ba chore: update readme to latest expo cli and node (#77) 2021-01-12 14:40:35 +01:00
Cedric van Putten 917e072b54 refactor: improve error handling with update check (#76) 2021-01-12 14:32:44 +01:00
Cedric van Putten ed7f67d90e refactor: update all dev dependencies to latest version (#71)
* refactor: use node 14 as primary version to build from

* refactor: add explicit return types to all files

* refactor: update all dev dependencies to latest version

* refactor: update strict typings in test utils
2020-12-04 19:52:01 +01:00
Cedric van Putten 13d78207a1 docs: update the cache description without the fork 2020-12-04 19:29:33 +01:00
Cedric van Putten 75b743cff5 refactor: group output by steps for readability (#70) 2020-12-04 19:20:56 +01:00
Cedric van Putten 187c4adfcc refactor: output cache errors with actions core 2020-12-04 17:10:23 +01:00
Matthew Ondash 0eb46e97d7 refactor: use official actions cache package instead of cypress fork (#62)
* Now uses official @actions/cache package

* Run yarn upgrade

* Add handling for ReserveCacheError (#1)

Bump @actions/cache from 1.0.2 to 1.0.3
Add missing caret to specify @actions/cache version range
Add handling for ReserveCacheError
2020-12-04 16:16:20 +01:00
Cedric van Putten 5d3c1cdff4 chore: release version 5.3.1 2020-10-20 18:08:45 +02:00
Cedric van Putten ce1c6b612a chore: rebuilt the project after dependency bump 2020-10-02 15:17:31 +02:00
dependabot[bot] b807fa603f chore: bump @actions/core from 1.2.4 to 1.2.6 (#63)
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] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-10-02 15:12:54 +02:00
Cedric van Putten 1010edb8c8 chore: release version 5.3.0 2020-09-19 03:57:01 +02:00
Cedric van Putten b80de3494e fix: rebuild full project with ncc 2020-09-19 03:50:47 +02:00
Cedric van Putten f773f9c85c chore: clean up outdated expo test 2020-08-28 17:14:35 +02:00
Cedric van Putten 1c36889886 feat: add expo token authentication method (#57) 2020-08-28 17:12:37 +02:00
Cedric van Putten ce3c32e185 chore: release new version 5.2.0 2020-07-14 16:04:39 +02:00
Cedric van Putten 050b7019f7 docs: update build badge in readme (#56) 2020-07-14 15:35:43 +02:00
Cedric van Putten 404bd09c6f chore: upgrade all dependencies to latest version (#55) 2020-07-14 15:30:19 +02:00
Cedric van Putten d3602b92b2 refactor: use github actions instead of circle (#54)
* refactor: use github actions instead of circle

* fix: only check outdated build on node 12

* refactor: replace paths in tests with join for windows

* refactor: change expo binary tests when logging in

* refactor: replace paths in tests with join for windows

* chore: only support current and future lts in ci

* chore: remove circle ci configuration

* fix: remove windows from up to date check
2020-07-14 15:13:30 +02:00
Paul Cowgill 6ac67f03d0 docs: fix grammar and link in readme
* Grammar fix

* Fix cache info link in README

* Use working link to point to original section
2020-07-10 20:19:43 +02:00
Darsh Shah b8a49f4d14 fix: proper space between icon and text (#50) 2020-06-14 01:38:10 +02:00
Cedric van Putten 84e06132b2 chore: release new version 5.1.1 2020-06-10 19:28:03 +02:00
Brad Bumbalough 71dfeab7a0 fix: use inputs metadata key (#49) 2020-06-10 19:23:27 +02:00
Cedric van Putten f6dba4e7ce docs: fix typo in secrets link 2020-05-11 11:09:34 +02:00
Cedric van Putten 586d2b1bea docs: tweak the license to make it identifyable 2020-05-11 09:44:02 +02:00
Cedric van Putten 39cd204496 docs: refine the readme and update header style (#48)
* docs: update footer with a better design

* docs: refine some of the documentation
2020-05-09 22:42:25 +02:00
Cedric van Putten 58185fbf10 chore: release new version 5.1.0 (#47) 2020-05-08 13:16:50 +02:00
Cedric van Putten a4955da38e fix: remove custom and add global error handling (#46) 2020-05-08 12:54:13 +02:00
Cedric van Putten cb490968ad test: check if build is up to date (#45) 2020-05-08 12:35:19 +02:00
Cedric van Putten 42793272a5 test: add missing cache unit tests (#44)
* test: add missing cache unit tests

* refactor: clean up the tests
2020-05-08 12:22:22 +02:00
Cedric van Putten a7b6ce4357 feat: fail when provided credentials are incorrect (#43)
* refactor: add and use restore env utils for testing

* feat: fail when provided credentials are incorrect
2020-05-08 10:40:00 +02:00
Cedric van Putten 32b5f9cee8 chore: update dependencies and configuration (#42)
* chore: update dependencies and configuration

* chore: update eslint to match typescript files

* chore: reconfigure jest for 27 defaults

* chore: switch to yarn instead of npm

* chore: add node 14 to circle ci
2020-05-08 10:22:47 +02:00
dependabot[bot] 4aaf05ff10 chore(deps): bump acorn from 5.7.3 to 5.7.4
Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
- [Release notes](https://github.com/acornjs/acorn/releases)
- [Commits](https://github.com/acornjs/acorn/compare/5.7.3...5.7.4)

Signed-off-by: dependabot[bot] <[email protected]>
2020-03-14 11:22:33 -07:00
Cedric van Putten 1cf961c401 chore: release new version with cache 2019-12-31 00:53:41 +00:00
Cedric van Putten 69801f0afc feat: implement caching using github actions cache (#35)
* feat: implement remote cache based on github actions cache

This allows us to use an internal remote cache, which is not "supported" by GitHub though.

* docs: update documentation about the built-in cache
2019-12-31 01:15:12 +01:00
Cedric van Putten 3ac4a96cb4 docs: update the default packager value in action (#34) 2019-12-30 19:32:56 +01:00
Cedric van Putten f80ef1f629 refactor: move index code to run (#33)
* refactor: move index code to run

This makes the code a bit more predicatable, it only self-executes when importing index

* chore: unify test code with it prefix
2019-12-30 19:28:55 +01:00
Cedric van Putten 2de5b8c3bd refactor!: use yarn by default instead of npm (#32)
Expo recommends using yarn, so lets use that by default.
2019-12-30 16:46:32 +01:00
Cedric van Putten 48288d587a refactor: use ncc to compile scripts (#31)
* refactor: use ncc to compile scripts into smaller files

* refactor: remove node modules from repo

These are now compiled into smaller files with ncc. No need to keep it in the repository.
2019-12-30 16:40:14 +01:00
Cedric van Putten 12f58a21ef refactor: make logs more visible (#30)
This should make the action steps a bit more transparent and could help developers debugging.
2019-12-30 15:47:47 +01:00
Cedric van Putten 7776e33fb4 refactor: update all dependencies to latest versions (#29) 2019-12-30 15:19:35 +01:00
dependabot[bot] 4aa2c230ec chore(deps): bump handlebars from 4.2.0 to 4.5.3 (#27)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.2.0 to 4.5.3.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/wycats/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.2.0...v4.5.3)

Signed-off-by: dependabot[bot] <[email protected]>
2019-12-30 15:09:31 +01:00
Cedric van Putten e5677e1fa3 refactor: use circleci instead of github actions (#28)
Unforuntately, GitHub decided that the Expo organisation doesnt have access to GitHub actions anymore (even for open source repositories).
2019-12-30 15:07:44 +01:00
Cedric van Putten 68a2de09aa docs: remove beta warning just before general availability 2019-10-30 23:34:45 +01:00
Cedric van Putten 831bcb12d3 fix: use cmd suffix when authenticating on windows 2019-10-30 23:19:48 +01:00
Cedric van Putten 8ff07e0da8 chore: enable workflow for pull requests 2019-10-30 23:12:46 +01:00
Cedric van Putten 16d4b1519f chore: update all dependencies to latest version 2019-10-30 21:05:59 +01:00
Cedric van Putten cbd9aceff6 fix: add patch for watchers limit and enospc error 2019-10-29 00:56:33 +01:00
Cedric van Putten a80a00b2cd release: new release for yml github actions 2019-09-29 14:46:00 +00:00
Cedric van Putten 38e963b075 docs: update documentation for the new action 2019-09-29 16:35:44 +02:00
Cedric van Putten 929a76ca04 feat: add github workflow for ci 2019-09-29 16:35:44 +02:00
Cedric van Putten 00692c48ca fix: add build and node node modules before commit 2019-09-29 16:35:44 +02:00
Cedric van Putten b2929e3879 fix: add build and node node modules in husky hook 2019-09-29 16:35:44 +02:00
Cedric van Putten 04cd479159 chore: add linter and fix all files 2019-09-29 16:35:44 +02:00
Cedric van Putten cec6e505c1 chore: add husky for repository deployments 2019-09-29 16:35:44 +02:00
Cedric van Putten 22df52e066 chore: add all missing tests 2019-09-29 16:35:44 +02:00
Cedric van Putten 98b1bea09b feat: add new expo action cli install concept 2019-09-29 16:35:44 +02:00
Cedric van Putten e72ddd8c15 refactor: remove travis config and base images
The future action will change to a JavaScript action that installs the Expo CLI globally. It should consist of multiple caching mechanisms to ensure fast consecutive builds.
2019-09-29 16:35:44 +02:00
Cedric van Putten 26c734a57d docs: simplify and link the environment variables info 2019-09-29 16:35:44 +02:00
Cedric van Putten f3bc71a12a docs: replace aliased email with normal email 2019-09-29 16:35:44 +02:00
Cedric van Putten 4766fa83e2 docs: write about entry point proxy and restructure for easy access 2019-09-29 16:35:44 +02:00
Cedric van Putten caf499b677 refactor: move entry point to expo as proxy 2019-09-29 16:35:44 +02:00
Cedric van Putten 5cfaee20e5 refactor: update proxy for non-interactive mode and help links 2019-09-29 16:35:44 +02:00
Cedric van Putten 81344e4392 feat: use new action metadata format 2019-09-29 16:35:44 +02:00
Cedric van Putten 89005bc95d docs: update license dates 2019-09-29 16:35:44 +02:00
Cedric van Putten 55b9dc47a8 release: new release for expo cli v3 2019-07-23 00:32:00 +02:00
Cedric van Putten 882d5f940b refactor: run travis in parallel for expo cli v2 and v3 2019-07-23 00:23:39 +02:00
Cedric van Putten cd33736735 refactor: add latest expo-cli v3 but keep v2 images updated 2019-07-23 00:23:39 +02:00
Cedric van Putten d1909bbd24 release: new release for image build with yarn 2019-05-09 00:23:37 +02:00
Cedric van Putten d9cb1dbb0e fix: use yarn to install expo cli globally
This is related to NPM failing for both iltorb and sharp dependencies. Let's work around this by using Yarn for now.

https://github.com/expo/expo-cli/issues/591
2019-05-09 00:20:19 +02:00
Cedric van Putten aff8989f53 release: new release for node memory limit fix 2019-04-17 00:24:06 +02:00
Cedric van Putten 698a1c68a5 chore: make travis build the action to double check the docker file 2019-04-17 00:01:01 +02:00
Cedric van Putten 4c25ef9693 fix: increase node memory limit to 4gb 2019-04-17 00:01:01 +02:00
Cedric van Putten aa752f2bde docs: add note about overwriting node options 2019-04-17 00:01:01 +02:00
Cedric van Putten fa422416ae docs: add extra link to base image in description 2019-04-14 18:28:04 +02:00
Cedric van Putten 92beb0f493 docs: rename build action to remove ambiguity with other examples 2019-04-14 18:24:01 +02:00
Cedric van Putten fe96c9dc68 release: create new release under expo and without subactions 2019-04-14 13:48:50 +02:00
Cedric van Putten a801b833a5 docs: add scheduled builds info and update examples 2019-04-14 13:42:19 +02:00
Cedric van Putten 2c88f88370 docs: add travis link to base image builds 2019-04-14 13:36:21 +02:00
Cedric van Putten 0ce8eff16c feat: build docker base image from travis ci
This will ensure staying up to date and should add some transparency how these images are made.
2019-04-14 13:36:21 +02:00
Cedric van Putten 4e2fd4d394 refactor: update base image labels 2019-04-14 13:12:08 +02:00
Cedric van Putten 3f55e8c261 docs: add 650 industries aka expo as license holder 2019-04-14 13:12:08 +02:00
Cedric van Putten b8ec50268d refactor: remove unofficial from the name 2019-04-14 13:06:53 +02:00
Cedric van Putten 0cfae07bbd refactor: remove deprecated subactions 2019-04-14 13:02:15 +02:00
Cedric van Putten fe86cd6f46 docs: add 650 industries aka expo as license holder 2019-04-14 13:01:47 +02:00
Cedric van Putten 617ebf80c7 docs: update references to action repository 2019-04-14 13:01:27 +02:00
Cedric van Putten e6a3b5c87a docs: use latest npm action because of an install failure
I'm not 100% sure why it happens, but there might be something wrong with the `1.0.0` version on this action. I think they are on 2 now, but it isn't "released" yet.
2019-04-10 23:39:48 +02:00
60 changed files with 169695 additions and 605 deletions

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
indent_style = space
trim_trailing_whitespace = false
[*.yml]
indent_size = 2
indent_style = space
+27
View File
@@ -0,0 +1,27 @@
module.exports = {
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'jest',
],
env: {
es6: true,
'jest/globals': true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-member-accessibility': [
'error', { 'accessibility': 'no-public' },
],
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/indent': ['error', 'tab'],
'@typescript-eslint/no-non-null-assertion': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
+55
View File
@@ -0,0 +1,55 @@
---
name: CI
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize]
jobs:
build:
name: Test and build
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: [12, 14]
os:
- macos-latest
- ubuntu-latest
- windows-latest
include:
- node: 14
os: macos-latest
checkUpToDate: true
- node: 14
os: ubuntu-latest
checkUpToDate: true
steps:
- name: Setup repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Find cache
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile --check-files
- name: Lint package
run: yarn lint
- name: Test package
run: yarn test
- name: Build clean
run: yarn clean
- name: Build package
run: yarn build
- name: Build up-to-date
if: ${{ matrix.checkUpToDate }}
run: git diff --stat --exit-code build
+51
View File
@@ -0,0 +1,51 @@
---
name: Release
on:
workflow_dispatch:
inputs:
release:
description: 'type "release" to confirm creating a new release (main branch only)'
required: false
jobs:
release:
name: Release version
runs-on: ubuntu-latest
steps:
- name: Setup repo
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Find cache
id: yarn-cache-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile --check-files
- name: Lint package
run: yarn lint
- name: Test package
run: yarn test
- name: Build clean
run: yarn clean
- name: Build package
run: yarn build
- name: Build up-to-date
run: git diff --stat --exit-code build
- name: Test-run release
if: success() && github.event.inputs.release != 'release'
run: yarn semantic-release --dry-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
if: success() && github.event.inputs.release == 'release' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
run: yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+1
View File
@@ -0,0 +1 @@
node_modules
+1
View File
@@ -0,0 +1 @@
_
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
yarn build
git add build
+8
View File
@@ -0,0 +1,8 @@
{
"printWidth": 120,
"tabWidth": 2,
"singleQuote": true,
"jsxBracketSameLine": true,
"trailingComma": "es5",
"arrowParens": "avoid"
}
+38
View File
@@ -0,0 +1,38 @@
const rules = [
{ type: 'feat', release: 'minor', title: 'New features' },
{ type: 'feature', release: 'minor', title: 'New features' },
{ type: 'fix', release: 'patch', title: 'Bug fixes' },
{ type: 'refactor', release: 'patch', title: 'Code changes' },
{ type: 'chore', release: 'patch', title: 'Other chores' },
{ type: 'docs', release: 'patch', title: 'Documentation changes' },
];
// Simple mapping to order the commit groups
const sortMap = Object.fromEntries(rules.map((rule, index) => [rule.title, index]));
module.exports = {
branches: ['main', 'master'],
tagFormat: '${version}',
plugins: [
['@semantic-release/commit-analyzer', {
preset: 'conventionalcommits',
releaseRules: rules.map(({ type, release }) => ({ type, release })),
}],
['@semantic-release/release-notes-generator', {
preset: 'conventionalcommits',
presetConfig: {
types: rules.map(({ type, title }) => ({ type, section: title })),
},
writerOpts: {
commitGroupsSort: (a, z) => sortMap[a.title] - sortMap[z.title],
},
}],
'@semantic-release/changelog',
['@semantic-release/npm', { npmPublish: false }],
['@semantic-release/git', {
message: 'chore: create new release ${nextRelease.version}\n\n${nextRelease.notes}',
assets: ['package.json', 'CHANGELOG.md'],
}],
'@semantic-release/github',
],
};
+304 -48
View File
@@ -1,63 +1,319 @@
## [2.2.0](https://github.com/bycedric/ci-expo/compare/2.1.0...2.2.0) (2019-04-10)
### Code refactors
* use better expo cli variables prefix ([cd75584](https://github.com/bycedric/ci-expo/commit/cd75584))
### Documentation changes
* pin actions to versions for future releases ([3c76843](https://github.com/bycedric/ci-expo/commit/3c76843))
### [5.5.1](https://github.com/expo/expo-github-action/compare/5.5.0...5.5.1) (2021-06-17)
## [2.1.0](https://github.com/bycedric/ci-expo/compare/2.0.0...2.1.0) (2019-04-10)
### Bug fixes
### Code refactors
* revert to node 12 for the action ([2662a5f](https://github.com/expo/expo-github-action/commit/2662a5f0dec42d7a9c66b55f8ce937f37aaac9b4))
* authenticate in main action if possible ([a401e30](https://github.com/bycedric/ci-expo/commit/a401e30))
* remove extraneous commands from base image ([a90ce59](https://github.com/bycedric/ci-expo/commit/a90ce59))
## [5.5.0](https://github.com/expo/expo-github-action/compare/5.4.0...5.5.0) (2021-06-17)
### Documentation changes
* add deprecation notice on all sub-actions ([b5a0311](https://github.com/bycedric/ci-expo/commit/b5a0311))
* add examples and more contextual info ([9625bb1](https://github.com/bycedric/ci-expo/commit/9625bb1))
* fix typo in documentation and use link references ([48bbaf3](https://github.com/bycedric/ci-expo/commit/48bbaf3))
* update license to 2019 ([7596f6b](https://github.com/bycedric/ci-expo/commit/7596f6b))
### Other chores
* add some issue templates to github ([9aec1f5](https://github.com/bycedric/ci-expo/commit/9aec1f5))
## [2.0.0](https://github.com/bycedric/ci-expo/compare/906c910...2.0.0) (2019-04-02)
### New features
* add basic ios build action ([3a81415](https://github.com/bycedric/ci-expo/commit/3a81415))
* add basic web build action ([3d4bdb6](https://github.com/bycedric/ci-expo/commit/3d4bdb6))
* add basic android build action ([9105177](https://github.com/bycedric/ci-expo/commit/9105177))
* add new publish action ([56563f2](https://github.com/bycedric/ci-expo/commit/56563f2))
* add login entrypoint ([252f16d](https://github.com/bycedric/ci-expo/commit/252f16d))
* add github actions implemented image for expo cli ([864b9bb](https://github.com/bycedric/ci-expo/commit/864b9bb))
* add base image with documentation and licenses ([c43e5c3](https://github.com/bycedric/ci-expo/commit/c43e5c3))
* switch to node 14 for the action itself ([f13b0ea](https://github.com/expo/expo-github-action/commit/f13b0ea032efcf2e6689743879af6b3e1c72201d))
### Code refactors
* tag all buid actions as unofficial for release ([ed597e5](https://github.com/bycedric/ci-expo/commit/ed597e5))
* simplify publish action and remove extraneous entrypoint ([61d0c21](https://github.com/bycedric/ci-expo/commit/61d0c21))
* tag all actions as unofficial for release to marketplace ([f56443a](https://github.com/bycedric/ci-expo/commit/f56443a))
* expand existing login with documentation and proper icon ([d2e2a6d](https://github.com/bycedric/ci-expo/commit/d2e2a6d))
* move cli to root as default ([4545e44](https://github.com/bycedric/ci-expo/commit/4545e44))
* expand existing login with documentation and proper icon ([923ed34](https://github.com/bycedric/ci-expo/commit/923ed34))
* remove third party notice until its updated ([f4fc39a](https://github.com/bycedric/ci-expo/commit/f4fc39a))
* use full node version instead of alpine ([a019c94](https://github.com/bycedric/ci-expo/commit/a019c94))
### Bug fixes
### Documentation changes
* add support for environments without remote cache ([#91](https://github.com/expo/expo-github-action/issues/91)) ([9c0e696](https://github.com/expo/expo-github-action/commit/9c0e6962510d4e08c6429cac42f624c563675ee1))
### Code changes
* simplify typescript config with community config ([#94](https://github.com/expo/expo-github-action/issues/94)) ([da4e754](https://github.com/expo/expo-github-action/commit/da4e75428b7c5ffd16e8b2c698f590313c741621))
* update all dependencies to latest versions ([#93](https://github.com/expo/expo-github-action/issues/93)) ([6bc0bed](https://github.com/expo/expo-github-action/commit/6bc0bedbc75bb0d6743e4accf032cd01348d6775))
* add link to login from publish action ([5b7564c](https://github.com/bycedric/ci-expo/commit/5b7564c))
* add custom cli command action ([4cf38f9](https://github.com/bycedric/ci-expo/commit/4cf38f9))
* add do not use in production warning ([8291794](https://github.com/bycedric/ci-expo/commit/8291794))
* add basic repository description ([906c910](https://github.com/bycedric/ci-expo/commit/906c910))
### Other chores
* remove the cli from name ([ab9265b](https://github.com/bycedric/ci-expo/commit/ab9265b))
* add semantic release for easy versioning ([#95](https://github.com/expo/expo-github-action/issues/95)) ([6354b0a](https://github.com/expo/expo-github-action/commit/6354b0a0477a72375cee808d8a5b6006d6e86e77))
* fix the allowed branches for semenatic release ([6b8c488](https://github.com/expo/expo-github-action/commit/6b8c488fd6239c9a76d7f95355a58bc8b2a20ac4))
* mock the github actions warning to avoid leaking annotations ([#96](https://github.com/expo/expo-github-action/issues/96)) ([a11a47a](https://github.com/expo/expo-github-action/commit/a11a47a3e8735a206eed196499604322b0bdc877))
* tweak the release workflow ([79ebfbc](https://github.com/expo/expo-github-action/commit/79ebfbc3b83497f443fd65eb5bd33484e5519f64))
### Documentation changes
* add missing release step to contributing guide ([04e3b32](https://github.com/expo/expo-github-action/commit/04e3b32e94e3abe9cd65d37c57a0cead55186970))
## [5.4.0](https://github.com/expo/expo-github-action/compare/5.3.1...5.4.0) (2021-01-12)
### New features
* improve error handling with update check ([#76](https://github.com/expo/expo-github-action/pull/76)) ([917e072](https://github.com/expo/expo-github-action/commit/917e072))
### Code refactors
* use official actions cache package instead of cypress fork ([#62](https://github.com/expo/expo-github-action/pull/62)) ([0eb46e9](https://github.com/expo/expo-github-action/commit/0eb46e9))
* output cache errors with actions core ([187c4ad](https://github.com/expo/expo-github-action/commit/187c4ad))
* group output by steps for readability ([#70](https://github.com/expo/expo-github-action/pull/70)) ([75b743c](https://github.com/expo/expo-github-action/commit/75b743c))
* update all dev dependencies to latest version ([#71](https://github.com/expo/expo-github-action/pull/71)) ([ed7f67d](https://github.com/expo/expo-github-action/commit/ed7f67d))
### Documentation changes
* update the cache description without the fork ([13d7820](https://github.com/expo/expo-github-action/commit/13d7820))
* update readme to latest expo cli and node ([#77](https://github.com/expo/expo-github-action/pull/77)) ([6c0f4d7](https://github.com/expo/expo-github-action/commit/6c0f4d7))
### Other chores
* update all dependencies to latest versions ([#78](https://github.com/expo/expo-github-action/pull/78)) ([4ec7251](https://github.com/expo/expo-github-action/commit/4ec7251))
## [5.3.1](https://github.com/expo/expo-github-action/compare/5.3.0...5.3.1) (2020-10-20)
### Other chores
* bump @actions/core from 1.2.4 to 1.2.6 ([#63](https://github.com/expo/expo-github-action/pull/63)) ([b807fa6](https://github.com/expo/expo-github-action/commit/b807fa6))
## [5.3.0](https://github.com/expo/expo-github-action/compare/5.2.0...5.3.0) (2020-09-19)
### New features
* add expo token authentication method ([#57](https://github.com/expo/expo-github-action/pull/57)) ([1c36889](https://github.com/expo/expo-github-action/commit/1c36889))
## [5.2.0](https://github.com/expo/expo-github-action/compare/5.1.1...5.2.0) (2020-07-14)
### Bug fixes
* proper space between icon and text ([#50](https://github.com/expo/expo-github-action/pull/50)) ([b8a49f4](https://github.com/expo/expo-github-action/commit/b8a49f4))
### Code refactors
* use github actions instead of circle ([#54](https://github.com/expo/expo-github-action/pull/54)) ([d3602b9](https://github.com/expo/expo-github-action/commit/d3602b9))
### Documentation changes
* fix grammar and link in readme ([#53](https://github.com/expo/expo-github-action/pull/53)) ([6ac67f0](https://github.com/expo/expo-github-action/commit/6ac67f0))
* update build badge in readme ([#56](https://github.com/expo/expo-github-action/pull/56)) ([050b701](https://github.com/expo/expo-github-action/commit/050b701))
### Other chores
* upgrade all dependencies to latest version ([#55](https://github.com/expo/expo-github-action/pull/55)) ([404bd09](https://github.com/expo/expo-github-action/commit/404bd09))
## [5.1.1](https://github.com/expo/expo-github-action/compare/5.1.0...5.1.1) (2020-06-10)
### Bug fixes
* use inputs metadata key ([#49](https://github.com/expo/expo-github-action/pull/49)) ([71dfeab](https://github.com/expo/expo-github-action/commit/71dfeab))
## [5.1.0](https://github.com/expo/expo-github-action/compare/5.0.0...5.1.0) (2020-05-08)
### New features
* fail when provided credentials are incorrect ([#43](https://github.com/expo/expo-github-action/pull/43)) ([a7b6ce4](https://github.com/expo/expo-github-action/commit/a7b6ce4))
### Bug fixes
* remove custom and add global error handling ([#46](https://github.com/expo/expo-github-action/pull/46)) ([a4955da](https://github.com/expo/expo-github-action/commit/a4955da))
### Test changes
* check if build is up to date ([#45](https://github.com/expo/expo-github-action/pull/45)) ([cb49096](https://github.com/expo/expo-github-action/commit/cb49096))
* add missing cache unit tests ([#44](https://github.com/expo/expo-github-action/pull/44)) ([4279327](https://github.com/expo/expo-github-action/commit/4279327))
### Other chores
* update dependencies and configuration ([#42](https://github.com/expo/expo-github-action/pull/42)) ([32b5f9c](https://github.com/expo/expo-github-action/commit/32b5f9c))
* **deps**: bump acorn from 5.7.3 to 5.7.4 ([#37](https://github.com/expo/expo-github-action/pull/37)) ([4aaf05f](https://github.com/expo/expo-github-action/commit/4aaf05f))
## [5.0.0](https://github.com/expo/expo-github-action/compare/4.1.0...5.0.0) (2019-12-31)
### BREAKING CHANGES
* use yarn by default instead of npm ([#32](https://github.com/expo/expo-github-action/pull/32)) ([2de5b8c3](https://github.com/expo/expo-github-action/commit/2de5b8c))
* use ncc to compile scripts ([#31](https://github.com/expo/expo-github-action/pull/31)) ([48288d58](https://github.com/expo/expo-github-action/commit/48288d5))
### New features
* implement caching using github actions cache ([#35](https://github.com/expo/expo-github-action/pull/35)) ([69801f0a](https://github.com/expo/expo-github-action/commit/69801f0))
### Code refactors
* move index code to run ([#33](https://github.com/expo/expo-github-action/pull/33)) ([f80ef1f6](https://github.com/expo/expo-github-action/commit/f80ef1f))
* use yarn by default instead of npm ([#32](https://github.com/expo/expo-github-action/pull/32)) ([2de5b8c3](https://github.com/expo/expo-github-action/commit/2de5b8c))
* use ncc to compile scripts ([#31](https://github.com/expo/expo-github-action/pull/31)) ([48288d58](https://github.com/expo/expo-github-action/commit/48288d5))
* make logs more visible ([#30](https://github.com/expo/expo-github-action/pull/30)) ([12f58a21](https://github.com/expo/expo-github-action/commit/12f58a2))
* update all dependencies to latest versions ([#29](https://github.com/expo/expo-github-action/pull/29)) ([7776e33f](https://github.com/expo/expo-github-action/commit/7776e33))
* use circleci instead of github actions ([#28](https://github.com/expo/expo-github-action/pull/28)) ([e5677e1f](https://github.com/expo/expo-github-action/commit/e5677e1))
### Documentation changes
* update the default packager value in action ([#34](https://github.com/expo/expo-github-action/pull/34)) ([3ac4a96c](https://github.com/expo/expo-github-action/commit/3ac4a96))
### Other chores
* **deps**: bump handlebars from 4.2.0 to 4.5.3 ([#27](https://github.com/expo/expo-github-action/pull/27)) ([4aa2c230](https://github.com/expo/expo-github-action/commit/4aa2c23))
## [4.1.0](https://github.com/expo/expo-github-action/compare/4.0.1...4.1.0) (2019-10-30)
### Bug fixes
* use cmd suffix when authenticating on windows ([831bcb1](https://github.com/expo/expo-github-action/commit/831bcb1))
### Documentation changes
* remove beta warning just before general availability ([68a2de0](https://github.com/expo/expo-github-action/commit/68a2de0))
### Other chores
* update all dependencies to latest version ([16d4b15](https://github.com/expo/expo-github-action/commit/16d4b15))
* enable workflow for pull requests ([8ff07e0](https://github.com/expo/expo-github-action/commit/8ff07e0))
## [4.0.0](https://github.com/expo/expo-github-action/compare/3.0.0...4.0.0) (2019-09-29)
### New features
* add github workflow for ci ([929a76c](https://github.com/expo/expo-github-action/commit/929a76c))
* add new expo action cli install concept ([98b1bea](https://github.com/expo/expo-github-action/commit/98b1bea))
* use new action metadata format ([81344e4](https://github.com/expo/expo-github-action/commit/81344e4))
### Bug fixes
* add build and node node modules before commit ([00692c4](https://github.com/expo/expo-github-action/commit/00692c4))
* add build and node node modules in husky hook ([b2929e3](https://github.com/expo/expo-github-action/commit/b2929e3))
### Code refactors
* remove travis config and base images ([e72ddd8](https://github.com/expo/expo-github-action/commit/e72ddd8))
* move entry point to expo as proxy ([caf499b](https://github.com/expo/expo-github-action/commit/caf499b))
* update proxy for non-interactive mode and help links ([5cfaee2](https://github.com/expo/expo-github-action/commit/5cfaee2))
### Documentation changes
* update documentation for the new action ([38e963b](https://github.com/expo/expo-github-action/commit/38e963b))
* simplify and link the environment variables info ([26c734a](https://github.com/expo/expo-github-action/commit/26c734a))
* replace aliased email with normal email ([f3bc71a](https://github.com/expo/expo-github-action/commit/f3bc71a))
* write about entry point proxy and restructure for easy access ([4766fa8](https://github.com/expo/expo-github-action/commit/4766fa8))
* update license dates ([89005bc](https://github.com/expo/expo-github-action/commit/89005bc))
### Other chores
* add linter and fix all files ([04cd479](https://github.com/expo/expo-github-action/commit/04cd479))
* add husky for repository deployments ([cec6e50](https://github.com/expo/expo-github-action/commit/cec6e50))
* add all missing tests ([22df52e](https://github.com/expo/expo-github-action/commit/22df52e))
## [3.0.0](https://github.com/expo/expo-github-action/compare/2.3.2...3.0.0) (2019-07-23)
## Code refactors
* run travis in parallel for expo cli v2 and v3 ([882d5f9](https://github.com/expo/expo-github-action/commit/882d5f9))
* add latest expo-cli v3 but keep v2 images updated ([cd33736](https://github.com/expo/expo-github-action/commit/cd33736))
## [2.3.2](https://github.com/expo/expo-github-action/compare/2.3.1...2.3.2) (2019-05-09)
### Bug fixes
* use yarn to install expo cli globally ([9fd3635](https://github.com/expo/expo-github-action/commit/9fd3635))
## [2.3.1](https://github.com/expo/expo-github-action/compare/2.3.0...2.3.1) (2019-04-17)
### Bug fixes
* increase node memory limit to 4gb ([4c25ef9](https://github.com/expo/expo-github-action/commit/4c25ef9))
### Documentation changes
* add note about overwriting node options ([aa752f2](https://github.com/expo/expo-github-action/commit/aa752f2))
* add extra link to base image in description ([fa42241](https://github.com/expo/expo-github-action/commit/fa42241))
* rename build action to remove ambiguity with other examples ([92beb0f](https://github.com/expo/expo-github-action/commit/92beb0f))
### Other chores
* make travis build the action to double check the docker file ([698a1c6](https://github.com/expo/expo-github-action/commit/698a1c6))
## [2.3.0](https://github.com/expo/expo-github-action/compare/2.2.0...2.3.0) (2019-04-14)
### New features
* build docker base image from travis ci ([0ce8eff](https://github.com/expo/expo-github-action/commit/0ce8eff))
### Code refactors
* update base image labels ([4e2fd4d](https://github.com/expo/expo-github-action/commit/4e2fd4d))
* remove unofficial from the name ([b8ec502](https://github.com/expo/expo-github-action/commit/b8ec502))
* remove deprecated subactions ([0cfae07](https://github.com/expo/expo-github-action/commit/0cfae07))
### Documentation changes
* add scheduled builds info and update examples ([a801b83](https://github.com/expo/expo-github-action/commit/a801b83))
* add travis link to base image builds ([2c88f88](https://github.com/expo/expo-github-action/commit/2c88f88))
* add 650 industries aka expo as license holder ([3f55e8c](https://github.com/expo/expo-github-action/commit/3f55e8c))
* add 650 industries aka expo as license holder ([fe86cd6](https://github.com/expo/expo-github-action/commit/fe86cd6))
* update references to action repository ([617ebf8](https://github.com/expo/expo-github-action/commit/617ebf8))
* use latest npm action because of an install failure ([e6a3b5c](https://github.com/expo/expo-github-action/commit/e6a3b5c))
## [2.2.0](https://github.com/expo/expo-github-action/compare/2.1.0...2.2.0) (2019-04-10)
### Code refactors
* use better expo cli variables prefix ([cd75584](https://github.com/expo/expo-github-action/commit/cd75584))
### Documentation changes
* pin actions to versions for future releases ([3c76843](https://github.com/expo/expo-github-action/commit/3c76843))
## [2.1.0](https://github.com/expo/expo-github-action/compare/2.0.0...2.1.0) (2019-04-10)
### Code refactors
* authenticate in main action if possible ([a401e30](https://github.com/expo/expo-github-action/commit/a401e30))
* remove extraneous commands from base image ([a90ce59](https://github.com/expo/expo-github-action/commit/a90ce59))
### Documentation changes
* add deprecation notice on all sub-actions ([b5a0311](https://github.com/expo/expo-github-action/commit/b5a0311))
* add examples and more contextual info ([9625bb1](https://github.com/expo/expo-github-action/commit/9625bb1))
* fix typo in documentation and use link references ([48bbaf3](https://github.com/expo/expo-github-action/commit/48bbaf3))
* update license to 2019 ([7596f6b](https://github.com/expo/expo-github-action/commit/7596f6b))
### Other chores
* add some issue templates to github ([9aec1f5](https://github.com/expo/expo-github-action/commit/9aec1f5))
## [2.0.0](https://github.com/expo/expo-github-action/compare/906c910...2.0.0) (2019-04-02)
### New features
* add basic ios build action ([3a81415](https://github.com/expo/expo-github-action/commit/3a81415))
* add basic web build action ([3d4bdb6](https://github.com/expo/expo-github-action/commit/3d4bdb6))
* add basic android build action ([9105177](https://github.com/expo/expo-github-action/commit/9105177))
* add new publish action ([56563f2](https://github.com/expo/expo-github-action/commit/56563f2))
* add login entrypoint ([252f16d](https://github.com/expo/expo-github-action/commit/252f16d))
* add github actions implemented image for expo cli ([864b9bb](https://github.com/expo/expo-github-action/commit/864b9bb))
* add base image with documentation and licenses ([c43e5c3](https://github.com/expo/expo-github-action/commit/c43e5c3))
### Code refactors
* tag all buid actions as unofficial for release ([ed597e5](https://github.com/expo/expo-github-action/commit/ed597e5))
* simplify publish action and remove extraneous entrypoint ([61d0c21](https://github.com/expo/expo-github-action/commit/61d0c21))
* tag all actions as unofficial for release to marketplace ([f56443a](https://github.com/expo/expo-github-action/commit/f56443a))
* expand existing login with documentation and proper icon ([d2e2a6d](https://github.com/expo/expo-github-action/commit/d2e2a6d))
* move cli to root as default ([4545e44](https://github.com/expo/expo-github-action/commit/4545e44))
* expand existing login with documentation and proper icon ([923ed34](https://github.com/expo/expo-github-action/commit/923ed34))
* remove third party notice until its updated ([f4fc39a](https://github.com/expo/expo-github-action/commit/f4fc39a))
* use full node version instead of alpine ([a019c94](https://github.com/expo/expo-github-action/commit/a019c94))
### Documentation changes
* add link to login from publish action ([5b7564c](https://github.com/expo/expo-github-action/commit/5b7564c))
* add custom cli command action ([4cf38f9](https://github.com/expo/expo-github-action/commit/4cf38f9))
* add do not use in production warning ([8291794](https://github.com/expo/expo-github-action/commit/8291794))
* add basic repository description ([906c910](https://github.com/expo/expo-github-action/commit/906c910))
### Other chores
* remove the cli from name ([ab9265b](https://github.com/expo/expo-github-action/commit/ab9265b))
+57
View File
@@ -0,0 +1,57 @@
# Contributing to Expo Github Action
## 📦 Download and Setup
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device. (`git remote add upstream [email protected]:expo/expo-github-action.git` 😉)
2. Make sure you have the following packages globally installed on your system:
- [node](https://nodejs.org/) (active Node LTS or higher is recommended)
- [yarn](https://yarnpkg.com/)
3. Install the Node packages (`yarn install`)
## 🏎️ Running a custom version
To try out your changed with Github Action, you have [to reference your fork and/or branch or commit reference](https://docs.github.com/en/actions/learn-github-actions/finding-and-customizing-actions#using-release-management-for-your-custom-actions) in the workflow you want to try. After that, you have two options:
1. Run the workflow in Github Actions itself by triggering your workflow.
2. Run the workflow locally with [nektos/act](https://github.com/nektos/act).
## ✅ Testing
Testing is done using [Jest](https://jestjs.io/https://jestjs.io/). Run `yarn test` to run Jest.
In CI we are running tests on multiple Node versions using Windows, Linux, and MacOS. Make sure they are passing for your PR.
## 📝 Writing a Commit Message
> If this is your first time committing to a large public repo, you could look through this neat tutorial: ["How to Write a Git Commit Message"](https://chris.beams.io/posts/git-commit/)
Commit messages are formatted using the [Conventional Commits](https://www.conventionalcommits.org/) format. You can take a look at [`.releaserc.js`](./.releaserc.js) for the allowed commit types.
```
docs: fix typo in xxx
feature: add support for SDK 40
chore: add test-case for custom completions
fix: improve logging for errors
refactor: update loading icon
```
## 🔎 Before Submitting a PR
To get your PR merged as fast as possible, please make sure you have done the following:
- Run `yarn lint --fix` to fix the formatting of the code. Ensure that `yarn lint` succeeds without errors or warnings.
- Run `yarn test` to make sure all normal use cases are passing.
- Run `yarn build` to ensure the build is up-to-date and runs correctly and without errors or warnings.
## 🚀 Releasing a new version
To release a new version for Github Actions, we have to create a new release in Github. You can run the `Release` workflow to generate a new version, changelog, and Github release.
After the exact version tag is created, update the `v{major}` tag to the latest major version. Make sure you are on the default branch at the commit of versioning.
```bash
$ git checkout master
$ git fetch --tags && git pull
$ git tag --force v{major}
$ git push --force --tags
```
-10
View File
@@ -1,10 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Expo CLI (unofficial)"
LABEL com.github.actions.description="Use any Expo CLI command in your GitHub Actions workflow."
LABEL com.github.actions.icon="terminal"
LABEL com.github.actions.color="gray-dark"
COPY entrypoint.sh LICENSE.md README.md /
entrypoint ["/entrypoint.sh"]
+3 -1
View File
@@ -1,6 +1,8 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
Copyright (c) 2019-present Cedric van Putten <me@bycedric.com>
Copyright (c) 2019-present 650 Industries, Inc. (aka Expo)
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
+255 -120
View File
@@ -1,156 +1,291 @@
# Expo for GitHub Actions
> GitHub Actions is still in beta, use it at your own risk.
Publish, build or manage your [Expo][link-expo] Project with GitHub Actions!
This repository contains a prebuilt base image with GitHub Actions implementations.
You can also use [the base image](base) in other Docker-based environments.
<div align="center">
<h1>expo github action</h1>
<p></p>
<p>Publish, build or manage your <a href="https://github.com/expo/expo">Expo</a> app with Github Actions!</p>
<sup>
<a href="https://github.com/expo/expo-github-action/releases">
<img src="https://img.shields.io/github/release/expo/expo-github-action/all.svg?style=flat-square" alt="releases" />
</a>
<a href="https://github.com/expo/expo-github-action/actions">
<img src="https://img.shields.io/github/workflow/status/expo/expo-github-action/CI/master.svg?style=flat-square" alt="builds" />
</a>
<a href="https://github.com/expo/expo-github-action/blob/master/LICENSE.md">
<img src="https://img.shields.io/github/license/expo/expo-github-action?style=flat-square" alt="license" />
</a>
</sup>
<br />
<p align="center">
<a href="https://github.com/expo/expo-github-action#configuration-options"><b>Usage</b></a>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp;
<a href="https://github.com/expo/expo-github-action#example-workflows"><b>Examples</b></a>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp;
<a href="https://github.com/expo/expo-github-action#things-to-know"><b>Caveats</b></a>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp;
<a href="https://github.com/expo/expo-github-action/blob/master/CHANGELOG.md"><b>Changelog</b></a>
</p>
<br />
</div>
## What's inside?
Within this Expo CLI action, you have full access to the original [Expo CLI][link-expo-cli].
That means you are able to perform any command like login, publish and build.
Also, this action will authenticate automatically when both `EXPO_CLI_USERNAME` and `EXPO_CLI_PASSWORD` variables are defined.
With this Expo action, you have full access to the [Expo CLI][link-expo-cli] itself.
It allows you to fully automate the `expo publish` or `expo build` process, leaving you with more time available for your project.
There are some additional features included to make the usage of this action as simple as possible, like caching and authentication.
> You don't necessarily need this action to use Expo.
> You can also add `expo-cli` as a dependency to your project and use the official [NPM action][link-actions-npm] for example.
> However, when you do that you need to manage authentication yourself.
## Configuration options
### Why use a base-image?
This action is customizable through variables; they are defined in the [`action.yml`](action.yml).
Here is a summary of all the variables that you can use and their purpose.
Every GitHub action will start from scratch, using the dockerfile as the starting point.
If you define `expo-cli` in this dockerfile, it will install it every time you run an action.
By using a prebuilt image, it basically "skips" the process of downloading the full CLI over and over again.
This makes the Expo actions overall faster.
variable | default | description
--- | --- | ---
`expo-username` | - | The username of your Expo account _(e.g. `bycedric`)_
`expo-token` | - | The token of your Expo account _(e.g. [`${{ secrets.EXPO_TOKEN }}`][link-actions-secrets])_
`expo-password` | - | The password of your Expo account _(e.g. [`${{ secrets.EXPO_CLI_PASSWORD }}`][link-actions-secrets])_
`expo-version` | `latest` | The Expo CLI version to use, can be any [SemVer][link-semver-playground]. _(e.g. `3.x`)_
`expo-packager` | `yarn` | The package manager to install the CLI with. _(e.g. `npm`)_
`expo-cache` | `false` | If it should use the [GitHub actions (remote) cache](#using-the-built-in-cache).
`expo-cache-key` | - | An optional custom (remote) cache key. _(**use with caution**)_
`expo-patch-watchers` | `true` | If it should [patch the `fs.inotify.` limits](#enospc-errors-on-linux).
### Used secrets
> Never hardcode `expo-token` or `expo-password` in your workflow, use [secrets][link-actions-secrets] to store them.
To authenticate with your Expo account, use the variables listed below.
In the Expo action you can define `secrets = ["EXPO_CLI_USERNAME", "EXPO_CLI_PASSWORD"]` to have them available.
variable | description
--- | ---
`EXPO_CLI_USERNAME` | The email address or username of your Expo account.
`EXPO_CLI_PASSWORD` | The password of your Expo account, [automatically picked up by the cli][link-expo-cli-password].
> Some Expo commands don't require authentication.
> Simply omit the `secrets = [...]` if you don't need it.
> It's also recommended to set the `expo-version` to avoid breaking changes when a new major version is released.
## Example workflows
Before you dive into the workflow examples, you should know the basics of GitHub Actions.
You can read more about this in the [GitHub Actions documentation][link-actions].
1. [Publish on any push](#publish-on-any-push)
2. [Publish on a specific branch](#publish-on-a-specific-branch)
3. [Test and build web every day at 08:00](#test-and-build-web-every-day-at-0800)
1. [Publish on any push to master](#publish-on-any-push-to-master)
2. [Cache Expo CLI for other jobs](#cache-expo-cli-for-other-jobs)
3. [Test PRs and publish a review version](#test-prs-and-publish-a-review-version)
4. [Test PRs on multiple nodes and systems](#test-prs-on-multiple-nodes-and-systems)
5. [Test and build web every day at 08:00](#test-and-build-web-every-day-at-0800)
6. [Authenticate using an Expo token](#authenticate-using-an-expo-token)
### Publish on any push
### Publish on any push to master
Below you can see the example configuration to publish whenever the repository is updated.
The workflow listens to the `push` event and resolves directly to the `publish` action.
Before publishing your app, it installs your project's dependencies using the [NPM action][link-actions-npm].
Below you can see the example configuration to publish whenever the master branch is updated.
The workflow listens to the `push` event and sets up Node 12 using the [Setup Node Action][link-actions-node].
It also authenticates the Expo project by defining both `expo-username` and `expo-password`.
```hcl
workflow "Install and Publish" {
on = "push"
resolves = ["Publish"]
}
action "Install" {
uses = "actions/[email protected]"
args = "install"
}
action "Publish" {
needs = "Install"
uses = "byCedric/[email protected]"
args = "publish"
secrets = ["EXPO_CLI_USERNAME", "EXPO_CLI_PASSWORD"]
}
```yml
name: Expo Publish
on:
push:
branches:
- master
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: expo/expo-github-action@v5
with:
expo-version: 4.x
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
- run: yarn install
- run: expo publish
```
### Publish on a specific branch
### Cache Expo CLI for other jobs
This workflow is similar to the [publish on any push](#publish-on-any-push) configuration.
It will install and test the code using the [NPM action][link-actions-npm] on every push.
But instead of publishing on any push too, it will publish on the `master` branch only.
Below you can see a slightly modified version of the example above.
In this one, we enabled the built-in cache that will reuse a previously installed Expo CLI.
It skips the installation part and extracts the files directly, boosting the performance of your workflow.
```hcl
workflow "Install and Publish" {
on = "push"
resolves = ["Publish"]
}
> You can [read more about the cache here](#using-the-built-in-cache)
action "Install" {
uses = "actions/[email protected]"
args = "install"
}
```yml
name: Expo Publish
on:
push:
branches:
- master
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: expo/expo-github-action@v5
with:
expo-version: 4.x
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
expo-cache: true
- run: yarn install
- run: expo publish
```
action "Test" {
needs = "Install"
uses = "actions/[email protected]"
args = "test"
}
### Test PRs and publish a review version
action "Filter branch" {
needs = "Test"
uses = "actions/bin/filter@master"
args = "branch master"
}
Reviewing pull requests can take some time if you have to read every line of code.
To make this easier, you can publish the edited version of the PR using a [release channel][link-expo-release-channels].
Below you can see an example of a workflow that publishes and comments on te PR when the app is published.
action "Publish" {
needs = "Filter branch"
uses = "byCedric/[email protected]"
args = "publish"
secrets = ["EXPO_CLI_USERNAME", "EXPO_CLI_PASSWORD"]
}
```yml
name: Expo Review
on: [pull_request]
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: expo/expo-github-action@v5
with:
expo-version: 4.x
expo-username: ${{ secrets.EXPO_CLI_USERNAME }}
expo-password: ${{ secrets.EXPO_CLI_PASSWORD }}
- run: yarn install
- run: expo publish --release-channel=pr-${{ github.event.number }}
- uses: unsplash/comment-on-pr@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: App is ready for review, you can [see it here](https://expo.io/@bycedric/use-expo?release-channel=pr-${{ github.event.number }}).
```
### Test PRs on multiple nodes and systems
With GitHub Actions, it's reasonably easy to set up a matrix build and test the app on multiple environments.
These matrixes can help to make sure your app runs smoothly on a broad set of different development machines.
> If you don't need automatic authentication, you can omit the `expo-username` and `expo-password` variables.
```yml
name: Expo CI
on: [pull_request]
jobs:
ci:
name: Continuous Integration
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node: [10, 12, 13]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: expo/expo-github-action@v5
with:
expo-version: 4.x
- run: yarn install
- run: yarn test
- run: expo doctor
```
### Test and build web every day at 08:00
The most significant change here is that we've changed the workflow trigger.
Instead of listening to push events, it's scheduled to run every day at 08:00.
You can also schedule jobs by using the cron syntax.
It can help to minimize the number of updates your users have to install.
> For web builds, you don't need to be authenticated.
> That's why `secrets = [...]` is omitted here.
```hcl
workflow "Install, Test and Build Web" {
on = "schedule(0 8 * * *)"
resolves = ["Publish"]
}
action "Install" {
uses = "actions/[email protected]"
args = "install"
}
action "Test" {
needs = "Install"
uses = "actions/[email protected]"
args = "test"
}
action "Publish" {
needs = "Test"
uses = "byCedric/[email protected]"
args = "build:web"
}
```yml
name: Expo Daily CI
on:
schedule:
- cron: 0 8 * * *
jobs:
ci:
name: Daily Continuous Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: expo/expo-github-action@v5
with:
expo-version: 4.x
- run: yarn install
- run: yarn test
- run: expo build:web
```
## License
### Authenticate using an Expo token
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
Instead of username and password, you can also authenticate using a token.
This might help increasing security and avoids adding username and password to your repository secrets.
--- ---
```yml
name: Expo Publish
on:
push:
branches:
- master
jobs:
publish:
name: Install and publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
- uses: expo/expo-github-action@v5
with:
expo-version: 4.x
expo-token: ${{ secrets.EXPO_TOKEN }}
- run: yarn install
- run: expo publish
```
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
## Things to know
[link-actions]: https://developer.github.com/actions/
[link-actions-npm]: https://github.com/actions/npm
[link-expo]: https://expo.io
[link-expo-cli]: https://docs.expo.io/versions/latest/workflow/expo-cli
[link-expo-cli-password]: https://github.com/expo/expo-cli/blob/8ea616d8848a123270b97e226e33dcb3dde49653/packages/expo-cli/src/accounts.js#L94
### Automatic Expo login
You need to authenticate for some Expo commands like `expo publish` and `expo build`.
This action gives you configuration options to keep your workflow simple.
You can choose if you want to authenticate using an `EXPO_TOKEN` or account credentials.
Under the hood, it uses the [`EXPO_CLI_PASSWORD`][link-expo-cli-password] environment variable to make credentials authentication as secure as possible.
> Note, this action only uses your token or credentials to authenticate with Expo. It doesn't store these anywhere.
### Using the built-in cache
You can opt-in to caching the installation, making it a lot faster.
Under the hood, it uses the [`@action/cache`][link-actions-cache-package] package to restore the Expo CLI installation.
This action generates a unique cache key for the OS, used packager, and exact version of the Expo CLI.
If you need more control over this cache, you can define a custom cache key with `expo-cache-key`.
> Note, this cache will count towards your [repo cache limit][link-actions-cache-limit].
### ENOSPC errors on Linux
When you run `expo publish` or `expo build`, a new bundle is created.
Creating these bundles require quite some resources.
As of writing, GitHub actions has some small default values for the `fs.inotify` settings.
Inside this action, we included a patch that increases these limits for the current workflow.
It increases the `max_user_instances`, `max_user_watches` and `max_queued_events` to `524288`.
You can disable this patch by setting the `expo-patch-watchers` to `false`.
<div align="center">
<br />
with :heart:&nbsp;<strong>byCedric</strong>
<br />
</div>
[link-actions]: https://help.github.com/en/categories/automating-your-workflow-with-github-actions
[link-actions-cache-limit]: https://github.com/actions/cache#cache-limits
[link-actions-cache-package]: https://www.npmjs.com/package/@actions/cache
[link-actions-node]: https://github.com/actions/setup-node
[link-actions-secrets]: https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
[link-expo-cli]: https://docs.expo.io/workflow/expo-cli/
[link-expo-cli-password]: https://github.com/expo/expo-cli/blob/master/packages/expo-cli/src/accounts.ts#L88-L90
[link-expo-release-channels]: https://docs.expo.io/distribution/release-channels/
[link-semver-playground]: https://semver.npmjs.com/
+31
View File
@@ -0,0 +1,31 @@
---
name: Expo GitHub Action
author: Cedric van Putten <[email protected]>
description: Expo CLI in your GitHub Actions workflow.
branding:
icon: terminal
color: gray-dark
runs:
using: node12
main: build/index.js
inputs:
expo-version:
description: The Expo CLI version to install. (use any semver/dist-tag available)
default: latest
expo-username:
description: Your Expo username, for authentication.
expo-token:
description: Your Expo token, for authentication. (use with secrets)
expo-password:
description: Your Expo password, for authentication. (use with secrets)
expo-packager:
description: The package manager used to install the Expo CLI. (can be yarn or npm)
default: yarn
expo-patch-watchers:
description: If Expo should fix the default watchers limit, helps with ENOSPC errors. (can be true or false)
default: true
expo-cache:
description: If Expo should be stored in the GitHub Actions cache (can be true or false)
default: false
expo-cache-key:
description: A custom remote cache key to use (best to let GitHub Actions handle it)
-14
View File
@@ -1,14 +0,0 @@
FROM node:10
LABEL name="Expo for Docker"
LABEL repository="https://github.com/bycedric/ci-expo"
LABEL homepage="https://github.com/bycedric/ci-expo/tree/master/base"
LABEL maintainer="Cedric van Putten <[email protected]>"
RUN npm install --global expo-cli@2 \
&& npm cache rm --force \
&& rm -rf ~/.npm
COPY entrypoint.sh LICENSE.md README.md /
ENTRYPOINT ["/entrypoint.sh"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-37
View File
@@ -1,37 +0,0 @@
# Expo for Docker
A prebuilt docker image to use the [Expo CLI][link-expo-cli] on Docker-based environments.
This image contains all necessary libraries to perform all commands of the CLI.
- Based on `node:10` image
- Contains globally installed `expo-cli@2`
## Usage
The entry point of this image forwards to the Expo CLI itself.
With this entry point, you can provide any command directly to Docker.
When nothing is provided, it will output the help information provided by the CLI.
> The entry point uses `sh -c` to invoke Expo, making environment variables available to that command.
```bash
$ docker run --rm bycedric/ci-expo
$ docker run --rm bycedric/ci-expo pubish
$ docker run --rm -ti bycedric/ci-expo login
$ docker run --rm -ti --entrypoint sh bycedric/ci-expo
```
> This image is intended to use on Docker-based CI environments, see [the Expo CI guide][link-expo-cicd] to get started.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
[link-expo-cli]: https://docs.expo.io/versions/latest/workflow/expo-cli
[link-expo-cicd]: https://docs.expo.io/versions/latest/guides/setting-up-continuous-integration
-4
View File
@@ -1,4 +0,0 @@
#!/bin/sh -l
set -e
sh -c "expo $*"
-8
View File
@@ -1,8 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Build Expo Android app (unofficial)"
LABEL com.github.actions.description="Create a standalone Android app in your GitHub Actions workflow."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="gray-dark"
ENTRYPOINT ["/entrypoint.sh", "build:android"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-31
View File
@@ -1,31 +0,0 @@
# Expo Build Android for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Create a new standalone Android build from your GitHub workflow.
Optionally, you can configure the properties of this standalone app.
> Make sure to [login](../login) before this step, else your workflow won't have the permission to build a new version
## Usage
Below you can see an example of a build Android action.
> Just like the [publish](../publish) action, you can customize the Android app.
```hcl
action "Build Android app" {
uses = "bycedric/ci-expo/build-android@master"
}
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
-8
View File
@@ -1,8 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Build Expo iOS app (unofficial)"
LABEL com.github.actions.description="Create a standalone iOS app in your GitHub Actions workflow."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="gray-dark"
ENTRYPOINT ["/entrypoint.sh", "build:ios"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-31
View File
@@ -1,31 +0,0 @@
# Expo Build iOS for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Create a new standalone iOS build from your GitHub workflow.
Optionally, you can configure the properties of this standalone app.
> Make sure to [login](../login) before this step, else your workflow won't have the permission to build a new version
## Usage
Below you can see an example of a build iOS action.
> Just like the [publish](../publish) action, you can customize the iOS app.
```hcl
action "Build iOS app" {
uses = "bycedric/ci-expo/build-ios@master"
}
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
-8
View File
@@ -1,8 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Build Expo web bundle (unofficial)"
LABEL com.github.actions.description="Create a bundle for web deployments from your GitHub Actions workflow."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="gray-dark"
ENTRYPOINT ["/entrypoint.sh", "build:web"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-31
View File
@@ -1,31 +0,0 @@
# Expo Build Web for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Create a new app web bundle from your GitHub workflow.
Optionally, you can configure the properties of this bundle.
> Authentication is not required for this step.
## Usage
Below you can see an example of a build web action.
> Just like the [publish](../publish) action, you can customize the web bundle.
```hcl
action "Build web bundle" {
uses = "bycedric/ci-expo/build-web@master"
}
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
+24
View File
@@ -0,0 +1,24 @@
if (module !== require.main) {
throw new Error("This file should not be loaded with require()")
}
if (!process.getuid || !process.getgid) {
throw new Error("this file should not be called without uid/gid support")
}
var argv = process.argv.slice(2)
, user = argv[0] || process.getuid()
, group = argv[1] || process.getgid()
if (!isNaN(user)) user = +user
if (!isNaN(group)) group = +group
console.error([user, group])
try {
process.setgid(group)
process.setuid(user)
console.log(JSON.stringify({uid:+process.getuid(), gid:+process.getgid()}))
} catch (ex) {
console.log(JSON.stringify({error:ex.message,errno:ex.errno}))
}
+160107
View File
File diff suppressed because it is too large. Load diff
+47
View File
@@ -0,0 +1,47 @@
'use strict'
const ls = require('../ls.js')
const get = require('../get.js')
const put = require('../put.js')
const rm = require('../rm.js')
const verify = require('../verify.js')
const setLocale = require('../lib/util/y.js').setLocale
const clearMemoized = require('../lib/memoization.js').clearMemoized
const tmp = require('../lib/util/tmp.js')
setLocale('en')
const x = module.exports
x.ls = cache => ls(cache)
x.ls.stream = cache => ls.stream(cache)
x.get = (cache, key, opts) => get(cache, key, opts)
x.get.byDigest = (cache, hash, opts) => get.byDigest(cache, hash, opts)
x.get.sync = (cache, key, opts) => get.sync(cache, key, opts)
x.get.sync.byDigest = (cache, key, opts) => get.sync.byDigest(cache, key, opts)
x.get.stream = (cache, key, opts) => get.stream(cache, key, opts)
x.get.stream.byDigest = (cache, hash, opts) => get.stream.byDigest(cache, hash, opts)
x.get.copy = (cache, key, dest, opts) => get.copy(cache, key, dest, opts)
x.get.copy.byDigest = (cache, hash, dest, opts) => get.copy.byDigest(cache, hash, dest, opts)
x.get.info = (cache, key) => get.info(cache, key)
x.get.hasContent = (cache, hash) => get.hasContent(cache, hash)
x.get.hasContent.sync = (cache, hash) => get.hasContent.sync(cache, hash)
x.put = (cache, key, data, opts) => put(cache, key, data, opts)
x.put.stream = (cache, key, opts) => put.stream(cache, key, opts)
x.rm = (cache, key) => rm.entry(cache, key)
x.rm.all = cache => rm.all(cache)
x.rm.entry = x.rm
x.rm.content = (cache, hash) => rm.content(cache, hash)
x.setLocale = lang => setLocale(lang)
x.clearMemoized = () => clearMemoized()
x.tmp = {}
x.tmp.mkdir = (cache, opts) => tmp.mkdir(cache, opts)
x.tmp.withTmp = (cache, opts, cb) => tmp.withTmp(cache, opts, cb)
x.verify = (cache, opts) => verify(cache, opts)
x.verify.lastRun = cache => verify.lastRun(cache)
+7
View File
@@ -0,0 +1,7 @@
{
"No cache entry for `%s` found in `%s`": "No cache entry for %s found in %s",
"Integrity verification failed for %s (%s)": "Integrity verification failed for %s (%s)",
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Bad data size: expected inserted data to be %s bytes, but got %s instead",
"Cache input stream was empty": "Cache input stream was empty",
"Integrity check failed:\n Wanted: %s\n Found: %s": "Integrity check failed:\n Wanted: %s\n Found: %s"
}
+49
View File
@@ -0,0 +1,49 @@
'use strict'
const ls = require('../ls.js')
const get = require('../get.js')
const put = require('../put.js')
const rm = require('../rm.js')
const verify = require('../verify.js')
const setLocale = require('../lib/util/y.js').setLocale
const clearMemoized = require('../lib/memoization.js').clearMemoized
const tmp = require('../lib/util/tmp.js')
setLocale('es')
const x = module.exports
x.ls = cache => ls(cache)
x.ls.flujo = cache => ls.stream(cache)
x.saca = (cache, clave, ops) => get(cache, clave, ops)
x.saca.porHacheo = (cache, hacheo, ops) => get.byDigest(cache, hacheo, ops)
x.saca.sinc = (cache, clave, ops) => get.sync(cache, clave, ops)
x.saca.sinc.porHacheo = (cache, hacheo, ops) => get.sync.byDigest(cache, hacheo, ops)
x.saca.flujo = (cache, clave, ops) => get.stream(cache, clave, ops)
x.saca.flujo.porHacheo = (cache, hacheo, ops) => get.stream.byDigest(cache, hacheo, ops)
x.sava.copia = (cache, clave, destino, opts) => get.copy(cache, clave, destino, opts)
x.sava.copia.porHacheo = (cache, hacheo, destino, opts) => get.copy.byDigest(cache, hacheo, destino, opts)
x.saca.info = (cache, clave) => get.info(cache, clave)
x.saca.tieneDatos = (cache, hacheo) => get.hasContent(cache, hacheo)
x.saca.tieneDatos.sinc = (cache, hacheo) => get.hasContent.sync(cache, hacheo)
x.mete = (cache, clave, datos, ops) => put(cache, clave, datos, ops)
x.mete.flujo = (cache, clave, ops) => put.stream(cache, clave, ops)
x.rm = (cache, clave) => rm.entry(cache, clave)
x.rm.todo = cache => rm.all(cache)
x.rm.entrada = x.rm
x.rm.datos = (cache, hacheo) => rm.content(cache, hacheo)
x.ponLenguaje = lang => setLocale(lang)
x.limpiaMemoizado = () => clearMemoized()
x.tmp = {}
x.tmp.mkdir = (cache, ops) => tmp.mkdir(cache, ops)
x.tmp.hazdir = x.tmp.mkdir
x.tmp.conTmp = (cache, ops, cb) => tmp.withTmp(cache, ops, cb)
x.verifica = (cache, ops) => verify(cache, ops)
x.verifica.ultimaVez = cache => verify.lastRun(cache)
x.verifica.últimaVez = x.verifica.ultimaVez
+6
View File
@@ -0,0 +1,6 @@
{
"No cache entry for `%s` found in `%s`": "No existe ninguna entrada para «%s» en «%s»",
"Integrity verification failed for %s (%s)": "Verificación de integridad falló para «%s» (%s)",
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Tamaño incorrecto de datos: los datos insertados debieron haber sido %s octetos, pero fueron %s",
"Cache input stream was empty": "El stream de entrada al caché estaba vacío"
}
+47
View File
@@ -0,0 +1,47 @@
'use strict'
const ls = require('../ls.js')
const get = require('../get.js')
const put = require('../put.js')
const rm = require('../rm.js')
const verify = require('../verify.js')
const setLocale = require('../lib/util/y.js').setLocale
const clearMemoized = require('../lib/memoization.js').clearMemoized
const tmp = require('../lib/util/tmp.js')
setLocale('en')
const x = module.exports
x.ls = cache => ls(cache)
x.ls.stream = cache => ls.stream(cache)
x.get = (cache, key, opts) => get(cache, key, opts)
x.get.byDigest = (cache, hash, opts) => get.byDigest(cache, hash, opts)
x.get.sync = (cache, key, opts) => get.sync(cache, key, opts)
x.get.sync.byDigest = (cache, key, opts) => get.sync.byDigest(cache, key, opts)
x.get.stream = (cache, key, opts) => get.stream(cache, key, opts)
x.get.stream.byDigest = (cache, hash, opts) => get.stream.byDigest(cache, hash, opts)
x.get.copy = (cache, key, dest, opts) => get.copy(cache, key, dest, opts)
x.get.copy.byDigest = (cache, hash, dest, opts) => get.copy.byDigest(cache, hash, dest, opts)
x.get.info = (cache, key) => get.info(cache, key)
x.get.hasContent = (cache, hash) => get.hasContent(cache, hash)
x.get.hasContent.sync = (cache, hash) => get.hasContent.sync(cache, hash)
x.put = (cache, key, data, opts) => put(cache, key, data, opts)
x.put.stream = (cache, key, opts) => put.stream(cache, key, opts)
x.rm = (cache, key) => rm.entry(cache, key)
x.rm.all = cache => rm.all(cache)
x.rm.entry = x.rm
x.rm.content = (cache, hash) => rm.content(cache, hash)
x.setLocale = lang => setLocale(lang)
x.clearMemoized = () => clearMemoized()
x.tmp = {}
x.tmp.mkdir = (cache, opts) => tmp.mkdir(cache, opts)
x.tmp.withTmp = (cache, opts, cb) => tmp.withTmp(cache, opts, cb)
x.verify = (cache, opts) => verify(cache, opts)
x.verify.lastRun = cache => verify.lastRun(cache)
+7
View File
@@ -0,0 +1,7 @@
{
"No cache entry for `%s` found in `%s`": "No cache entry for %s found in %s",
"Integrity verification failed for %s (%s)": "Integrity verification failed for %s (%s)",
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Bad data size: expected inserted data to be %s bytes, but got %s instead",
"Cache input stream was empty": "Cache input stream was empty",
"Integrity check failed:\n Wanted: %s\n Found: %s": "Integrity check failed:\n Wanted: %s\n Found: %s"
}
+49
View File
@@ -0,0 +1,49 @@
'use strict'
const ls = require('../ls.js')
const get = require('../get.js')
const put = require('../put.js')
const rm = require('../rm.js')
const verify = require('../verify.js')
const setLocale = require('../lib/util/y.js').setLocale
const clearMemoized = require('../lib/memoization.js').clearMemoized
const tmp = require('../lib/util/tmp.js')
setLocale('es')
const x = module.exports
x.ls = cache => ls(cache)
x.ls.flujo = cache => ls.stream(cache)
x.saca = (cache, clave, ops) => get(cache, clave, ops)
x.saca.porHacheo = (cache, hacheo, ops) => get.byDigest(cache, hacheo, ops)
x.saca.sinc = (cache, clave, ops) => get.sync(cache, clave, ops)
x.saca.sinc.porHacheo = (cache, hacheo, ops) => get.sync.byDigest(cache, hacheo, ops)
x.saca.flujo = (cache, clave, ops) => get.stream(cache, clave, ops)
x.saca.flujo.porHacheo = (cache, hacheo, ops) => get.stream.byDigest(cache, hacheo, ops)
x.sava.copia = (cache, clave, destino, opts) => get.copy(cache, clave, destino, opts)
x.sava.copia.porHacheo = (cache, hacheo, destino, opts) => get.copy.byDigest(cache, hacheo, destino, opts)
x.saca.info = (cache, clave) => get.info(cache, clave)
x.saca.tieneDatos = (cache, hacheo) => get.hasContent(cache, hacheo)
x.saca.tieneDatos.sinc = (cache, hacheo) => get.hasContent.sync(cache, hacheo)
x.mete = (cache, clave, datos, ops) => put(cache, clave, datos, ops)
x.mete.flujo = (cache, clave, ops) => put.stream(cache, clave, ops)
x.rm = (cache, clave) => rm.entry(cache, clave)
x.rm.todo = cache => rm.all(cache)
x.rm.entrada = x.rm
x.rm.datos = (cache, hacheo) => rm.content(cache, hacheo)
x.ponLenguaje = lang => setLocale(lang)
x.limpiaMemoizado = () => clearMemoized()
x.tmp = {}
x.tmp.mkdir = (cache, ops) => tmp.mkdir(cache, ops)
x.tmp.hazdir = x.tmp.mkdir
x.tmp.conTmp = (cache, ops, cb) => tmp.withTmp(cache, ops, cb)
x.verifica = (cache, ops) => verify(cache, ops)
x.verifica.ultimaVez = cache => verify.lastRun(cache)
x.verifica.últimaVez = x.verifica.ultimaVez
+6
View File
@@ -0,0 +1,6 @@
{
"No cache entry for `%s` found in `%s`": "No existe ninguna entrada para «%s» en «%s»",
"Integrity verification failed for %s (%s)": "Verificación de integridad falló para «%s» (%s)",
"Bad data size: expected inserted data to be %s bytes, but got %s instead": "Tamaño incorrecto de datos: los datos insertados debieron haber sido %s octetos, pero fueron %s",
"Cache input stream was empty": "El stream de entrada al caché estaba vacío"
}
-11
View File
@@ -1,11 +0,0 @@
#!/bin/sh -l
set -e
if [ -n "$EXPO_CLI_USERNAME" ] && [ -n "$EXPO_CLI_PASSWORD" ]; then
expo login --username $EXPO_CLI_USERNAME
else
echo 'Skipping Expo login, username and/or password not defined...'
fi
sh -c "expo $*"
+11
View File
@@ -0,0 +1,11 @@
module.exports = {
verbose: true,
clearMocks: true,
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testRunner: 'jest-circus/runner',
transform: {
'^.+\\.ts$': 'ts-jest'
},
};
-11
View File
@@ -1,11 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Login with Expo (unofficial)"
LABEL com.github.actions.description="Authenticate with Expo your GitHub Actions workflow."
LABEL com.github.actions.icon="log-in"
LABEL com.github.actions.color="gray-dark"
COPY LICENSE.md README.md /
COPY entrypoint.sh /entrypoint-login.sh
ENTRYPOINT ["/entrypoint-login.sh"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-34
View File
@@ -1,34 +0,0 @@
# Expo Login for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Authenticate the current workflow to publish new versions or create new builds.
It works relatively simple, you define the Expo credentials, and this action will do the rest.
## Usage
First you need to define the [secrets listed below][#secrets] through [GitHub secrets](https://developer.github.com/actions/managing-workflows/storing-secrets/).
After that, you can add the action below in your workflow.
```hcl
action "Login with Expo" {
uses = "bycedric/ci-expo/login@master"
secrets = ["EXPO_USERNAME", "EXPO_PASSWORD"]
}
```
### Secrets
* `EXPO_USERNAME` - **Required**. The email address or username of the Expo account.
* `EXPO_PASSWORD` - **Required**. The password of the Expo account.
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
-10
View File
@@ -1,10 +0,0 @@
#!/bin/sh -l
set -e
if [ -n "$EXPO_USERNAME" ] && [ -n "$EXPO_PASSWORD" ]; then
expo login --username $EXPO_USERNAME --password $EXPO_PASSWORD
else
echo "Please define both EXPO_USERNAME and EXPO_PASSWORD."
exit 1
fi
+54
View File
@@ -0,0 +1,54 @@
{
"private": true,
"name": "expo-github-action",
"version": "5.5.1",
"description": "Expo CLI in your GitHub Actions workflow",
"main": "build/index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/expo/expo-github-action.git"
},
"author": "Cedric van Putten <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/expo/expo-github-action/issues"
},
"homepage": "https://github.com/expo/expo-github-action#readme",
"scripts": {
"test": "jest",
"lint": "tsc --noEmit && eslint --ext ts ./src ./tests",
"build": "ncc build src/index.ts --out build",
"clean": "rimraf build",
"prepare": "husky install"
},
"dependencies": {
"@actions/cache": "^1.0.7",
"@actions/core": "^1.4.0",
"@actions/exec": "^1.1.0",
"@actions/io": "^1.1.1",
"@actions/tool-cache": "^1.7.1",
"libnpm": "^3.0.1",
"semver": "^7.3.5"
},
"devDependencies": {
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@tsconfig/node14": "^1.0.1",
"@types/jest": "^26.0.23",
"@types/node": "^14.17.3",
"@types/semver": "^7.3.6",
"@typescript-eslint/eslint-plugin": "^4.27.0",
"@typescript-eslint/parser": "^4.27.0",
"@zeit/ncc": "^0.22.3",
"conventional-changelog-conventionalcommits": "^4.6.0",
"eslint": "^7.28.0",
"eslint-plugin-jest": "^24.3.6",
"husky": "^6.0.0",
"jest": "^27.0.4",
"jest-circus": "^27.0.4",
"rimraf": "^3.0.2",
"semantic-release": "^17.4.4",
"ts-jest": "^27.0.3",
"typescript": "^4.3.3"
}
}
-10
View File
@@ -1,10 +0,0 @@
FROM bycedric/ci-expo:2
LABEL com.github.actions.name="Publish to Expo (unofficial)"
LABEL com.github.actions.description="Publish a new release to Expo in your GitHub Actions workflow."
LABEL com.github.actions.icon="box"
LABEL com.github.actions.color="gray-dark"
COPY LICENSE.md README.md /
ENTRYPOINT ["/entrypoint.sh", "publish"]
-21
View File
@@ -1,21 +0,0 @@
# The MIT License (MIT)
Copyright (c) 2019 Cedric van Putten <me@bycedric.com>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
> in the Software without restriction, including without limitation the rights
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> copies of the Software, and to permit persons to whom the Software is
> furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in
> all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> THE SOFTWARE.
-52
View File
@@ -1,52 +0,0 @@
# Expo Publish for GitHub Actions
> **This sub-action is no longer required and will be removed in the next release.**
> _See the [example workflows](../README.md#example-workflows) for more info._
Publish a brand new release straight from your GitHub workflow.
Optionally, you can configure the release channel or manifest file.
> Make sure to [login](../login) before this step, else your workflow won't have the permission to build a new version
## Usage
Below you can see an example of a publish action.
By default, it will publish to the default release channel with the manifest located at `app.json`.
```hcl
action "Publish to Expo" {
uses = "bycedric/ci-expo/publish@master"
}
```
### Release channels
You can also use a different release channel, to test before the actual build goes live for example.
```hcl
action "Publish to Expo" {
uses = "bycedric/ci-expo/publish@master"
args = "--release-channel staging"
}
```
### Custom manifest
When using non-default locations for the manifest, you can use the `--config` argument.
```hcl
action "Publish to Expo" {
uses = "bycedric/ci-expo/publish@master"
args = "--config custom-app.json"
}
```
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
--- ---
<p align="center">
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
</p>
+92
View File
@@ -0,0 +1,92 @@
import { ReserveCacheError, restoreCache, saveCache } from '@actions/cache';
import * as core from '@actions/core';
import * as toolCache from '@actions/tool-cache';
import path from 'path';
import os from 'os';
/**
* Get the path to the `expo-cli` from cache, if any.
* Note, this cache is **NOT** shared between jobs.
*
* @see https://github.com/actions/toolkit/issues/47
*/
export async function fromLocalCache(version: string): Promise<string | undefined> {
return toolCache.find('expo-cli', version);
}
/**
* Store the root of `expo-cli` in the cache, for future reuse.
* Note, this cache is **NOT** shared between jobs.
*
* @see https://github.com/actions/toolkit/issues/47
*/
export async function toLocalCache(root: string, version: string): Promise<string> {
return toolCache.cacheDir(root, 'expo-cli', version);
}
/**
* Download the remotely stored `expo-cli` from cache, if any.
* Note, this cache is shared between jobs.
*/
export async function fromRemoteCache(version: string, packager: string, customCacheKey?: string): Promise<string | undefined> {
// see: https://github.com/actions/toolkit/blob/8a4134761f09d0d97fb15f297705fd8644fef920/packages/tool-cache/src/tool-cache.ts#L401
const target = path.join(process.env['RUNNER_TOOL_CACHE'] || '', 'expo-cli', version, os.arch());
const cacheKey = customCacheKey || getRemoteKey(version, packager);
try {
// When running with nektos/act, or other custom environments, the cache might not be set up.
const hit = await restoreCache([target], cacheKey);
if (hit) {
return target;
}
} catch (error) {
if (!handleRemoteCacheError(error)) {
throw error;
}
}
}
/**
* Store the root of `expo-cli` in the remote cache, for future reuse.
* Note, this cache is shared between jobs.
*/
export async function toRemoteCache(source: string, version: string, packager: string, customCacheKey?: string): Promise<void> {
const cacheKey = customCacheKey || getRemoteKey(version, packager);
try {
await saveCache([source], cacheKey);
} catch (error) {
if (!handleRemoteCacheError(error)) {
throw error;
}
}
}
/**
* Get the cache key to use when (re)storing the Expo CLI from remote cache.
*/
function getRemoteKey(version: string, packager: string): string {
return `expo-cli-${process.platform}-${os.arch()}-${packager}-${version}`;
}
/**
* Handle any incoming errors from cache methods.
* This can include actual errors like `ReserveCacheErrors` or unavailability errors.
* When the error is handled, it MUST provide feedback for the developer.
*
* @returns If the error was handled properly.
*/
function handleRemoteCacheError(error: Error): boolean {
const isReserveCacheError = error instanceof ReserveCacheError;
const isCacheUnavailable = error.message.toLowerCase().includes(
'cache service url not found',
);
if (isReserveCacheError || isCacheUnavailable) {
core.warning('Skipping remote cache storage, encountered error:');
core.warning(error.message);
return true;
}
return false;
}
+4
View File
@@ -0,0 +1,4 @@
import { run } from './run';
import { handleError } from './tools';
run().catch(handleError);
+53
View File
@@ -0,0 +1,53 @@
import * as core from '@actions/core';
import * as cli from '@actions/exec';
import * as io from '@actions/io';
import * as path from 'path';
import { fromLocalCache, fromRemoteCache, toLocalCache, toRemoteCache } from './cache';
export type InstallConfig = {
version: string;
packager: string;
cache?: boolean;
cacheKey?: string;
};
/**
* Install `expo-cli`, by version, using the packager.
* Here you can provide any semver range or dist tag used in the registry.
* It returns the path where Expo is installed.
*/
export async function install(config: InstallConfig): Promise<string> {
let root: string | undefined = await fromLocalCache(config.version);
if (!root && config.cache) {
root = await fromRemoteCache(config.version, config.packager, config.cacheKey);
} else {
core.info('Skipping remote cache, not enabled...');
}
if (!root) {
root = await fromPackager(config.version, config.packager);
root = await toLocalCache(root, config.version);
if (config.cache) {
await toRemoteCache(root, config.version, config.packager, config.cacheKey);
}
}
return path.join(root, 'node_modules', '.bin');
}
/**
* Install `expo-cli`, by version, using npm or yarn.
* It creates a temporary directory to store all required files.
*/
export async function fromPackager(version: string, packager: string): Promise<string> {
const root = process.env['RUNNER_TEMP'] || '';
const tool = await io.which(packager);
await io.mkdirP(root);
await cli.exec(tool, ['add', `expo-cli@${version}`], { cwd: root });
return root;
}
+43
View File
@@ -0,0 +1,43 @@
import { addPath, getInput, group } from '@actions/core';
import { install, InstallConfig } from './install';
import { maybeAuthenticate, maybePatchWatchers, resolveVersion } from './tools';
export async function run(): Promise<void> {
const config: InstallConfig = {
version: getInput('expo-version') || 'latest',
packager: getInput('expo-packager') || 'yarn',
cache: (getInput('expo-cache') || 'false') === 'true',
cacheKey: getInput('expo-cache-key') || undefined,
};
// Resolve the exact requested Expo CLI version
config.version = await resolveVersion(config.version);
const path = await group(
config.cache
? `Installing Expo CLI (${config.version}) from cache or with ${config.packager}`
: `Installing Expo CLI (${config.version}) with ${config.packager}`,
() => install(config),
);
addPath(path);
await group(
'Checking current authenticated account',
() => maybeAuthenticate({
token: getInput('expo-token') || undefined,
username: getInput('expo-username') || undefined,
password: getInput('expo-password') || undefined,
}),
);
const shouldPatchWatchers = getInput('expo-patch-watchers') || 'true';
if (shouldPatchWatchers !== 'false') {
await group(
'Patching system watchers for the `ENOSPC` error',
() => maybePatchWatchers(),
);
}
}
+104
View File
@@ -0,0 +1,104 @@
import * as core from '@actions/core';
import * as cli from '@actions/exec';
import semver from 'semver';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const registry = require('libnpm');
type AuthenticateOptions = {
token?: string;
username?: string;
password?: string;
};
/**
* Resolve the provided semver to exact version of `expo-cli`.
* This uses the npm registry and accepts latest, dist-tags or version ranges.
* It's used to determine the cached version of `expo-cli`.
*/
export async function resolveVersion(version: string): Promise<string> {
return (await registry.manifest(`expo-cli@${version}`)).version;
}
/**
* Authenticate with Expo using either the token or username/password method.
* If both of them are set, token has priority.
*/
export async function maybeAuthenticate(options: AuthenticateOptions = {}): Promise<void> {
// github actions toolkit will handle commands with `.cmd` on windows, we need that
const bin = process.platform === 'win32' ? 'expo.cmd' : 'expo';
if (options.token) {
await cli.exec(bin, ['whoami'], {
env: { ...process.env, EXPO_TOKEN: options.token },
});
return core.exportVariable('EXPO_TOKEN', options.token);
}
if (options.username || options.password) {
if (!options.username || !options.password) {
return core.info('Skipping authentication: `expo-username` and/or `expo-password` not set...');
}
await cli.exec(bin, ['login', `--username=${options.username}`], {
env: { ...process.env, EXPO_CLI_PASSWORD: options.password },
});
return;
}
core.info('Skipping authentication: `expo-token`, `expo-username`, and/or `expo-password` not set...');
}
/**
* Try to patch the default watcher/inotify limit.
* This is a limitation from GitHub Actions and might be an issue in some Expo projects.
* It sets the system's `fs.inotify` limits to a more sensible setting.
*
* @see https://github.com/expo/expo-github-action/issues/20
*/
export async function maybePatchWatchers(): Promise<void> {
if (process.platform !== 'linux') {
return core.info('Skipping patch for watchers, not running on Linux...');
}
core.info('Patching system watchers for the `ENOSPC` error...');
try {
// see https://github.com/expo/expo-cli/issues/277#issuecomment-452685177
await cli.exec('sudo sysctl fs.inotify.max_user_instances=524288');
await cli.exec('sudo sysctl fs.inotify.max_user_watches=524288');
await cli.exec('sudo sysctl fs.inotify.max_queued_events=524288');
await cli.exec('sudo sysctl -p');
} catch {
core.warning("Looks like we can't patch watchers/inotify limits, you might encouter the `ENOSPC` error.");
core.warning('For more info, https://github.com/expo/expo-github-action/issues/20');
}
}
/**
* Check if there is a new major version available.
* If there is, create a warning for people to upgrade their workflow.
* Because this introduces additional requests, it should only be executed when necessary.
*/
export async function maybeWarnForUpdate(): Promise<void> {
const latest = await resolveVersion('latest');
const current = await resolveVersion(core.getInput('expo-version') || 'latest');
if (semver.diff(latest, current) === 'major') {
core.warning(`There is a new major version available of the Expo CLI (${latest})`);
core.warning(`If you run into issues, try upgrading your workflow to "expo-version: ${semver.major(latest)}.x"`);
}
}
/**
* Handle errors when this action fails, providing useful next-steps for developers.
* This mostly checks if the installed version is the latest version.
*/
export async function handleError(error: Error) {
try {
await maybeWarnForUpdate();
} catch {
// If this fails, ignore it
}
core.setFailed(error);
}
+131
View File
@@ -0,0 +1,131 @@
import os from 'os';
import { join } from 'path';
import * as remoteCache from '@actions/cache';
import * as core from '@actions/core';
import * as toolCache from '@actions/tool-cache';
import * as cache from '../src/cache';
import * as utils from './utils';
describe('fromLocalCache', () => {
it('fetches the version specific cache', async () => {
const path = join('path', 'to', 'local', 'cache');
// todo: check why jest wants `never` instead of `string`
const find = jest.spyOn(toolCache, 'find').mockResolvedValue(path as never);
const result = await cache.fromLocalCache('3.20.1');
expect(result).toBe(path);
expect(find).toBeCalledWith('expo-cli', '3.20.1');
});
});
describe('toLocalCache', () => {
it('stores the version specific cache', async () => {
const path = join('path', 'to', 'local', 'cache');
const root = join('path', 'from', 'source');
const cacheDir = jest.spyOn(toolCache, 'cacheDir').mockResolvedValue(path);
const result = await cache.toLocalCache(root, '3.20.1');
expect(result).toBe(path);
expect(cacheDir).toBeCalledWith(root, 'expo-cli', '3.20.1');
});
});
describe('fromRemoteCache', () => {
let spy: { [key: string]: jest.SpyInstance } = {};
beforeEach(() => {
spy = {
restore: jest.spyOn(remoteCache, 'restoreCache').mockImplementation(),
warning: jest.spyOn(core, 'warning').mockImplementation(),
};
});
beforeAll(() => {
utils.setEnv('RUNNER_TOOL_CACHE', join('cache', 'path'));
});
afterAll(() => {
utils.restoreEnv();
spy.restore.mockRestore();
spy.warning.mockRestore();
});
it('restores remote cache with default key', async () => {
expect(await cache.fromRemoteCache('3.20.1', 'yarn')).toBeUndefined();
expect(remoteCache.restoreCache).toBeCalledWith(
[join('cache', 'path', 'expo-cli', '3.20.1', os.arch())],
`expo-cli-${process.platform}-${os.arch()}-yarn-3.20.1`,
);
});
it('restores remote cache with custom key', async () => {
expect(await cache.fromRemoteCache('3.20.0', 'yarn', 'custom-cache-key')).toBeUndefined();
expect(remoteCache.restoreCache).toBeCalledWith(
[join('cache', 'path', 'expo-cli', '3.20.0', os.arch())],
'custom-cache-key',
);
});
it('returns path when remote cache exists', async () => {
spy.restore.mockResolvedValueOnce(true);
await expect(cache.fromRemoteCache('3.20.1', 'npm')).resolves.toBe(
join('cache', 'path', 'expo-cli', '3.20.1', os.arch())
);
});
it('fails when remote cache throws', async () => {
const error = new Error('Remote cache restore failed');
spy.restore.mockRejectedValueOnce(error);
await expect(cache.fromRemoteCache('3.20.1', 'yarn')).rejects.toBe(error);
});
it('skips remote cache when unavailable', async () => {
// see: https://github.com/actions/toolkit/blob/9167ce1f3a32ad495fc1dbcb574c03c0e013ae53/packages/cache/src/internal/cacheHttpClient.ts#L41
const error = new Error('Cache Service Url not found, unable to restore cache.');
spy.restore.mockRejectedValueOnce(error);
await expect(cache.fromRemoteCache('3.20.1', 'yarn')).resolves.toBeUndefined();
expect(spy.warning).toHaveBeenCalledWith(expect.stringContaining('Skipping remote cache'));
});
});
describe('toRemoteCache', () => {
let spy: { [key: string]: jest.SpyInstance } = {};
beforeEach(() => {
spy = {
save: jest.spyOn(remoteCache, 'saveCache').mockImplementation(),
warning: jest.spyOn(core, 'warning').mockImplementation(),
};
});
afterAll(() => {
spy.save.mockRestore();
spy.warning.mockRestore();
});
it('saves remote cache with default key', async () => {
expect(await cache.toRemoteCache(join('local', 'path'), '3.20.1', 'npm')).toBeUndefined();
expect(remoteCache.saveCache).toBeCalledWith(
[join('local', 'path')],
`expo-cli-${process.platform}-${os.arch()}-npm-3.20.1`
);
});
it('saves remote cache with custom key', async () => {
expect(await cache.toRemoteCache(join('local', 'path'), '3.20.1', 'yarn', 'custom-cache-key')).toBeUndefined();
expect(remoteCache.saveCache).toBeCalledWith([join('local', 'path')], 'custom-cache-key');
});
it('fails when remote cache throws', async () => {
const error = new Error('Remote cache save failed');
spy.save.mockRejectedValueOnce(error);
await expect(cache.toRemoteCache(join('local', 'path'), '3.20.1', 'yarn')).rejects.toBe(error);
});
it('skips remote cache when unavailable', async () => {
// see: https://github.com/actions/toolkit/blob/9167ce1f3a32ad495fc1dbcb574c03c0e013ae53/packages/cache/src/internal/cacheHttpClient.ts#L41
const error = new Error('Cache Service Url not found, unable to restore cache.');
spy.save.mockRejectedValueOnce(error);
await expect(cache.toRemoteCache(join('local', 'path'), '3.20.1', 'yarn')).resolves.toBeUndefined();
expect(spy.warning).toHaveBeenCalledWith(expect.stringContaining('Skipping remote cache'));
});
});
+80
View File
@@ -0,0 +1,80 @@
const cli = { exec: jest.fn() };
const io = { mkdirP: jest.fn(), which: jest.fn() };
const cache = {
fromLocalCache: jest.fn(),
fromRemoteCache: jest.fn(),
toLocalCache: jest.fn(),
toRemoteCache: jest.fn(),
};
jest.mock('@actions/exec', () => cli);
jest.mock('@actions/io', () => io);
jest.mock('../src/cache', () => cache);
import { join } from 'path';
import * as install from '../src/install';
import * as utils from './utils';
describe('install', () => {
it('installs path from local cache', async () => {
cache.fromLocalCache.mockResolvedValue(join('cache', 'path'));
const expoPath = await install.install({ version: '3.0.10', packager: 'npm' });
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
});
it('installs path from packager and cache it locally', async () => {
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
cache.fromLocalCache.mockResolvedValue(undefined);
cache.toLocalCache.mockResolvedValue(join('cache', 'path'));
const expoPath = await install.install({ version: '3.0.10', packager: 'npm' });
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
expect(cache.toLocalCache).toBeCalledWith(join('temp', 'path'), '3.0.10');
utils.restoreEnv();
});
it('installs path from remote cache', async () => {
cache.fromLocalCache.mockResolvedValue(undefined);
cache.fromRemoteCache.mockResolvedValue(join('cache', 'path'));
const expoPath = await install.install({ version: '3.20.1', packager: 'npm', cache: true });
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
expect(cache.fromRemoteCache).toBeCalledWith('3.20.1', 'npm', undefined);
});
it('installs path from packager and cache it remotely', async () => {
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
cache.fromLocalCache.mockResolvedValue(undefined);
cache.fromRemoteCache.mockResolvedValue(undefined);
cache.toLocalCache.mockResolvedValue(join('cache', 'path'));
const expoPath = await install.install({ version: '3.20.1', packager: 'npm', cache: true });
expect(expoPath).toBe(join('cache', 'path', 'node_modules', '.bin'));
expect(cache.toRemoteCache).toBeCalledWith(join('cache', 'path'), '3.20.1', 'npm', undefined);
utils.restoreEnv();
});
});
describe('fromPackager', () => {
it('resolves tool path', async () => {
await install.fromPackager('3.0.10', 'npm');
expect(io.which).toBeCalledWith('npm');
});
it('creates temporary folder', async () => {
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
await install.fromPackager('latest', 'yarn');
expect(io.mkdirP).toBeCalledWith(join('temp', 'path'));
utils.restoreEnv();
});
it('installs expo with tool', async () => {
utils.setEnv('RUNNER_TEMP', join('temp', 'path'));
io.which.mockResolvedValue('npm');
const expoPath = await install.fromPackager('beta', 'npm');
expect(expoPath).toBe(join('temp', 'path'));
expect(cli.exec).toBeCalled();
expect(cli.exec.mock.calls[0][0]).toBe('npm');
expect(cli.exec.mock.calls[0][1]).toStrictEqual(['add', 'expo-cli@beta']);
expect(cli.exec.mock.calls[0][2]).toMatchObject({ cwd: join('temp', 'path') });
utils.restoreEnv();
});
});
+108
View File
@@ -0,0 +1,108 @@
const core = {
addPath: jest.fn(),
getInput: jest.fn(),
group: (message: string, action: () => Promise<any>) => action()
};
const exec = { exec: jest.fn() };
const install = { install: jest.fn() };
const tools = {
resolveVersion: jest.fn(v => v),
maybeAuthenticate: jest.fn(),
maybePatchWatchers: jest.fn(),
};
jest.mock('@actions/core', () => core);
jest.mock('@actions/exec', () => exec);
jest.mock('../src/tools', () => tools);
jest.mock('../src/install', () => install);
import { run } from '../src/run';
interface MockInputProps {
version?: string;
packager?: string;
token?: string;
username?: string;
password?: string;
patchWatchers?: string;
cache?: string;
cacheKey?: string;
}
const mockInput = (props: MockInputProps = {}) => {
// fix: kind of dirty workaround for missing "mock 'value' based on arguments"
const input = (name: string) => {
switch (name) {
case 'expo-version':
return props.version || '';
case 'expo-packager':
return props.packager || '';
case 'expo-token':
return props.token || '';
case 'expo-username':
return props.username || '';
case 'expo-password':
return props.password || '';
case 'expo-patch-watchers':
return props.patchWatchers || '';
case 'expo-cache':
return props.cache || '';
case 'expo-cache-key':
return props.cacheKey || '';
default:
return '';
}
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
core.getInput = input as any;
};
describe('run', () => {
it('installs latest expo-cli with yarn by default', async () => {
await run();
expect(install.install).toBeCalledWith({ version: 'latest', packager: 'yarn', cache: false });
});
it('installs provided version expo-cli with npm', async () => {
mockInput({ version: '3.0.10', packager: 'npm' });
await run();
expect(install.install).toBeCalledWith({ version: '3.0.10', packager: 'npm', cache: false });
});
it('installs path to global path', async () => {
install.install.mockResolvedValue('/expo/install/path');
await run();
expect(core.addPath).toBeCalledWith('/expo/install/path');
});
it('patches the system when set to true', async () => {
mockInput({ patchWatchers: 'true' });
await run();
expect(tools.maybePatchWatchers).toHaveBeenCalled();
});
it('patches the system when not set', async () => {
mockInput({ patchWatchers: '' });
await run();
expect(tools.maybePatchWatchers).toHaveBeenCalled();
});
it('skips the system patch when set to false', async () => {
mockInput({ patchWatchers: 'false' });
await run();
expect(tools.maybePatchWatchers).not.toHaveBeenCalled();
});
it('authenticates with provided credentials', async () => {
mockInput({ username: 'bycedric', password: 'mypassword', patchWatchers: 'false' });
await run();
expect(tools.maybeAuthenticate).toBeCalledWith({ username: 'bycedric', password: 'mypassword' });
});
it('authenticates with provided token', async () => {
mockInput({ token: 'ABC123', patchWatchers: 'false' });
await run();
expect(tools.maybeAuthenticate).toBeCalledWith({ token: 'ABC123' });
});
});
+282
View File
@@ -0,0 +1,282 @@
const registry = { manifest: jest.fn() };
jest.mock('libnpm', () => registry);
import * as core from '@actions/core';
import * as cli from '@actions/exec';
import * as tools from '../src/tools';
import * as utils from './utils';
describe('resolveVersion', () => {
it('fetches exact version of expo-cli', async () => {
registry.manifest.mockResolvedValue({ version: '3.0.10' });
expect(await tools.resolveVersion('latest')).toBe('3.0.10');
expect(registry.manifest).toBeCalledWith('expo-cli@latest');
});
});
describe('maybeAuthenticate', () => {
const token = 'ABC123';
const username = 'bycedric';
const password = 'mypassword';
describe('with token', () => {
let spy: { [key: string]: jest.SpyInstance } = {};
beforeEach(() => {
spy = {
exportVariable: jest.spyOn(core, 'exportVariable').mockImplementation(),
exec: jest.spyOn(cli, 'exec').mockImplementation(),
info: jest.spyOn(core, 'info').mockImplementation(),
};
});
afterAll(() => {
spy.exportVariable.mockRestore();
spy.exec.mockRestore();
spy.info.mockRestore();
});
it('skips authentication without token', async () => {
await tools.maybeAuthenticate();
expect(spy.exec).not.toBeCalled();
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping authentication'));
});
it('executes whoami command with token through environment', async () => {
utils.setEnv('TEST_INCLUDED', 'hellyeah');
await tools.maybeAuthenticate({ token });
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][1]).toStrictEqual(['whoami']);
expect(spy.exec.mock.calls[0][2]).toMatchObject({
env: {
TEST_INCLUDED: 'hellyeah',
EXPO_TOKEN: token,
},
});
utils.restoreEnv();
});
it('fails when token is incorrect', async () => {
const error = new Error('Not logged in');
spy.exec.mockRejectedValue(error);
await expect(tools.maybeAuthenticate({ token })).rejects.toBe(error);
});
it('executes whoami command with `expo` on macos', async () => {
utils.setPlatform('darwin');
await tools.maybeAuthenticate({ token });
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][0]).toBe('expo');
utils.restorePlatform();
});
it('executes whoami command with `expo` on ubuntu', async () => {
utils.setPlatform('linux');
await tools.maybeAuthenticate({ token });
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][0]).toBe('expo');
utils.restorePlatform();
});
it('executes whoami command with `expo.cmd` on windows', async () => {
utils.setPlatform('win32');
await tools.maybeAuthenticate({ token });
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][0]).toBe('expo.cmd');
utils.restorePlatform();
});
});
describe('credentials', () => {
let spy: { [key: string]: jest.SpyInstance } = {};
beforeEach(() => {
spy = {
exec: jest.spyOn(cli, 'exec').mockImplementation(),
info: jest.spyOn(core, 'info').mockImplementation(),
};
});
afterAll(() => {
spy.exec.mockRestore();
spy.info.mockRestore();
});
it('skips authentication without credentials', async () => {
await tools.maybeAuthenticate();
expect(spy.exec).not.toBeCalled();
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping authentication'));
});
it('skips authentication without password', async () => {
await tools.maybeAuthenticate({ username });
expect(spy.exec).not.toBeCalled();
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping authentication'));
});
it('executes login command with password through environment', async () => {
utils.setEnv('TEST_INCLUDED', 'hellyeah');
await tools.maybeAuthenticate({ username, password })
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][1]).toStrictEqual(['login', `--username=${username}`]);
expect(spy.exec.mock.calls[0][2]).toMatchObject({
env: {
TEST_INCLUDED: 'hellyeah',
EXPO_CLI_PASSWORD: password,
},
});
utils.restoreEnv();
});
it('fails when credentials are incorrect', async () => {
const error = new Error('Invalid username/password. Please try again.');
spy.exec.mockRejectedValue(error);
await expect(tools.maybeAuthenticate({ username, password }))
.rejects
.toBe(error);
});
it('executes login command with `expo` on macos', async () => {
utils.setPlatform('darwin');
await tools.maybeAuthenticate({ username, password });
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][0]).toBe('expo');
utils.restorePlatform();
});
it('executes login command with `expo` on ubuntu', async () => {
utils.setPlatform('linux');
await tools.maybeAuthenticate({ username, password });
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][0]).toBe('expo');
utils.restorePlatform();
});
it('executes login command with `expo.cmd` on windows', async () => {
utils.setPlatform('win32');
await tools.maybeAuthenticate({ username, password });
expect(spy.exec).toBeCalled();
expect(spy.exec.mock.calls[0][0]).toBe('expo.cmd');
utils.restorePlatform();
});
});
});
describe('maybePatchWatchers', () => {
let spy: { [key: string]: jest.SpyInstance } = {};
beforeEach(() => {
spy = {
info: jest.spyOn(core, 'info').mockImplementation(),
warning: jest.spyOn(core, 'warning').mockImplementation(),
exec: jest.spyOn(cli, 'exec').mockImplementation(),
};
});
afterEach(() => {
utils.restorePlatform();
});
afterAll(() => {
spy.info.mockRestore();
spy.warning.mockRestore();
spy.exec.mockRestore();
});
it('increses fs inotify settings with sysctl', async () => {
utils.setPlatform('linux');
await tools.maybePatchWatchers();
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_instances=524288');
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_watches=524288');
expect(spy.exec).toBeCalledWith('sudo sysctl fs.inotify.max_queued_events=524288');
expect(spy.exec).toBeCalledWith('sudo sysctl -p');
});
it('warns for unsuccessful patches', async () => {
const error = new Error('Something went wrong');
spy.exec.mockRejectedValueOnce(error);
utils.setPlatform('linux');
await tools.maybePatchWatchers();
expect(core.warning).toBeCalledWith(expect.stringContaining("can't patch watchers"));
expect(core.warning).toBeCalledWith(
expect.stringContaining('https://github.com/expo/expo-github-action/issues/20')
);
});
it('skips on windows platform', async () => {
utils.setPlatform('win32');
await tools.maybePatchWatchers();
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping'));
expect(spy.exec).not.toHaveBeenCalled();
});
it('skips on macos platform', async () => {
utils.setPlatform('darwin');
await tools.maybePatchWatchers();
expect(spy.info).toBeCalledWith(expect.stringContaining('Skipping'));
expect(spy.exec).not.toHaveBeenCalled();
});
it('runs on linux platform', async () => {
utils.setPlatform('linux');
await tools.maybePatchWatchers();
expect(spy.info).toBeCalledWith(expect.stringContaining('Patching'));
expect(spy.exec).toHaveBeenCalled();
});
});
describe('maybeWarnForUpdate', () => {
let spy: { [key: string]: jest.SpyInstance } = {};
beforeEach(() => {
spy = { warning: jest.spyOn(core, 'warning').mockImplementation() };
});
afterAll(() => {
spy.warning.mockRestore();
});
it('is silent when major version is up to date', async () => {
registry.manifest
.mockResolvedValueOnce({ version: '4.1.0' })
.mockResolvedValueOnce({ version: '4.0.1'});
await tools.maybeWarnForUpdate();
expect(spy.warning).not.toBeCalled();
})
it('warns when major version is outdated', async () => {
registry.manifest
.mockResolvedValueOnce({ version: '4.1.0' })
.mockResolvedValueOnce({ version: '3.0.1'});
await tools.maybeWarnForUpdate();
expect(spy.warning).toBeCalledWith('There is a new major version available of the Expo CLI (4.1.0)');
expect(spy.warning).toBeCalledWith('If you run into issues, try upgrading your workflow to "expo-version: 4.x"');
})
});
describe('handleError', () => {
let spy: { [key: string]: jest.SpyInstance } = {};
beforeEach(() => {
spy = { setFailed: jest.spyOn(core, 'setFailed').mockImplementation() };
});
afterAll(() => {
spy.setFailed.mockRestore();
});
it('marks the job as failed', async () => {
const error = new Error('test');
registry.manifest.mockResolvedValue('4.0.0');
await tools.handleError(error);
expect(core.setFailed).toBeCalledWith(error);
});
it('fails with original error when update warning failed', async () => {
const error = new Error('test');
registry.manifest.mockRejectedValue(new Error('npm issue'));
await tools.handleError(error);
expect(core.setFailed).toBeCalledWith(error);
});
});
+34
View File
@@ -0,0 +1,34 @@
// keep track of the original one to revert the platform
const originalPlatform = process.platform;
/**
* Change the node platform for testing purposes.
* With this you can fake the `process.platform`.
*/
export function setPlatform(platform: NodeJS.Platform): void {
Object.defineProperty(process, 'platform', { value: platform });
}
/**
* Revert the platform to the original one.
*/
export function restorePlatform(): void {
setPlatform(originalPlatform);
}
// keep track of the original environment variables
const originalEnv = { ...process.env };
/**
* Change the environment variable for testing purposes.
*/
export function setEnv(name: string, value: string): void {
process.env[name] = value;
}
/**
* Revert the environment variable changes.
*/
export function restoreEnv(): void {
process.env = originalEnv;
}
+13
View File
@@ -0,0 +1,13 @@
{
"extends": "./node_modules/@tsconfig/node14/tsconfig.json",
"compilerOptions": {
"outDir": "./build",
"rootDir": "./src",
"noImplicitAny": false
},
"exclude": [
"build",
"node_modules",
"tests/**"
]
}
+7485
View File
File diff suppressed because it is too large. Load diff