mirror of
https://github.com/expo/expo-github-action.git
synced 2026-11-15 17:32:45 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d260aeca26 | ||
|
|
72d406754f | ||
|
|
521de724fc | ||
|
|
633cdf0ac9 | ||
|
|
c5d2c0f8c0 | ||
|
|
439ff4c9aa | ||
|
|
3ae799926e | ||
|
|
3007741466 | ||
|
|
4908a48f1b | ||
|
|
3f9e947963 | ||
|
|
ee415b027a | ||
|
|
414c1693e6 | ||
|
|
4f28493708 | ||
|
|
3134e26b3a | ||
|
|
3bf9181edb | ||
|
|
39b0d361f7 | ||
|
|
f1fe877592 | ||
|
|
ff2ff0f980 | ||
|
|
1cfa7bbd9e | ||
|
|
8a7306a978 | ||
|
|
c20146f3b7 | ||
|
|
a9b9cfef50 | ||
|
|
3b3e6b8031 | ||
|
|
186ef0011a | ||
|
|
45b79a05ef | ||
|
|
0b1822a935 | ||
|
|
b60246939f | ||
|
|
b099f17d58 | ||
|
|
50c0ef9028 | ||
|
|
92ec93fa37 | ||
|
|
5f5673ba77 | ||
|
|
1c8e5a21e9 | ||
|
|
3ba667b43f | ||
|
|
f14253ea9c | ||
|
|
a2d9b1cadf | ||
|
|
def44e2c77 | ||
|
|
c3c02de017 | ||
|
|
8b43bae073 | ||
|
|
a03876e3c5 | ||
|
|
04692c3cb1 | ||
|
|
1b57c37e9b | ||
|
|
76ce4de80e | ||
|
|
a888e4f311 | ||
|
|
2662a5f0de | ||
|
|
d4dc05e178 | ||
|
|
04e3b32e94 | ||
|
|
a11a47a3e8 | ||
|
|
79ebfbc3b8 | ||
|
|
6b8c488fd6 | ||
|
|
f13b0ea032 | ||
|
|
6354b0a047 | ||
|
|
da4e75428b | ||
|
|
6bc0bedbc7 | ||
|
|
9c0e696251 | ||
|
|
8275e8fa89 | ||
|
|
4ec7251759 | ||
|
|
6c0f4d78ba | ||
|
|
917e072b54 | ||
|
|
ed7f67d90e | ||
|
|
13d78207a1 | ||
|
|
75b743cff5 | ||
|
|
187c4adfcc | ||
|
|
0eb46e97d7 | ||
|
|
5d3c1cdff4 | ||
|
|
ce1c6b612a | ||
|
|
b807fa603f | ||
|
|
1010edb8c8 | ||
|
|
b80de3494e | ||
|
|
f773f9c85c | ||
|
|
1c36889886 | ||
|
|
ce3c32e185 | ||
|
|
050b7019f7 | ||
|
|
404bd09c6f | ||
|
|
d3602b92b2 | ||
|
|
6ac67f03d0 | ||
|
|
b8a49f4d14 | ||
|
|
84e06132b2 | ||
|
|
71dfeab7a0 | ||
|
|
f6dba4e7ce | ||
|
|
586d2b1bea | ||
|
|
39cd204496 | ||
|
|
58185fbf10 | ||
|
|
a4955da38e | ||
|
|
cb490968ad | ||
|
|
42793272a5 | ||
|
|
a7b6ce4357 | ||
|
|
32b5f9cee8 | ||
|
|
4aaf05ff10 | ||
|
|
1cf961c401 | ||
|
|
69801f0afc | ||
|
|
3ac4a96cb4 | ||
|
|
f80ef1f629 | ||
|
|
2de5b8c3bd | ||
|
|
48288d587a | ||
|
|
12f58a21ef | ||
|
|
7776e33fb4 | ||
|
|
4aa2c230ec | ||
|
|
e5677e1fa3 | ||
|
|
68a2de09aa | ||
|
|
831bcb12d3 | ||
|
|
8ff07e0da8 | ||
|
|
16d4b1519f | ||
|
|
cbd9aceff6 | ||
|
|
a80a00b2cd | ||
|
|
38e963b075 | ||
|
|
929a76ca04 | ||
|
|
00692c48ca | ||
|
|
b2929e3879 | ||
|
|
04cd479159 | ||
|
|
cec6e505c1 | ||
|
|
22df52e066 | ||
|
|
98b1bea09b | ||
|
|
e72ddd8c15 | ||
|
|
26c734a57d | ||
|
|
f3bc71a12a | ||
|
|
4766fa83e2 | ||
|
|
caf499b677 | ||
|
|
5cfaee20e5 | ||
|
|
81344e4392 | ||
|
|
89005bc95d | ||
|
|
55b9dc47a8 | ||
|
|
882d5f940b | ||
|
|
cd33736735 | ||
|
|
d1909bbd24 | ||
|
|
d9cb1dbb0e | ||
|
|
aff8989f53 | ||
|
|
698a1c68a5 | ||
|
|
4c25ef9693 | ||
|
|
aa752f2bde | ||
|
|
fa422416ae | ||
|
|
92beb0f493 |
No files matched your search
@@ -0,0 +1,8 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
ignorePatterns: ['build/**', 'node_modules/**'],
|
||||
extends: ['universe/node'],
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
# Handle line endings automatically for files detected as text
|
||||
# and leave all files detected as binary untouched.
|
||||
* text=auto
|
||||
|
||||
# These files are text and should be normalized (Convert crlf => lf)
|
||||
build/** text eol=lf
|
||||
@@ -0,0 +1,43 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release:
|
||||
description: 'type "release" to create the release (main branch only)'
|
||||
required: false
|
||||
|
||||
concurrency:
|
||||
group: release
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
release: ${{ github.ref == 'refs/heads/main' && github.event.inputs.release == 'release' }}
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
|
||||
- name: 📋 Dry-running release
|
||||
if: ${{ !env.release }}
|
||||
run: yarn semantic-release --dry-run
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: 📋 Release code
|
||||
if: ${{ env.release }}
|
||||
run: yarn semantic-release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,56 @@
|
||||
name: review
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
|
||||
concurrency:
|
||||
group: review-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
node: [16.x]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
|
||||
- name: 📦 Install dependencies
|
||||
run: yarn install --frozen-lockfile --check-files
|
||||
|
||||
- name: ✅ Lint code
|
||||
run: yarn lint
|
||||
|
||||
- name: 🧪 Test code
|
||||
run: yarn test
|
||||
|
||||
- name: 👷 Build code
|
||||
run: yarn clean && yarn build
|
||||
|
||||
- name: 🕵️ Validate build
|
||||
id: diff
|
||||
run: |
|
||||
if [ "$(git diff --ignore-space-at-eol build/ | wc -l)" -gt "0" ]; then
|
||||
echo "⚠️ Build is outdated"
|
||||
echo " > run 'yarn clean', 'yarn build', and commit changes"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 🗂 Upload build
|
||||
uses: actions/upload-artifact@v2
|
||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||
with:
|
||||
name: build
|
||||
path: build/
|
||||
@@ -0,0 +1,48 @@
|
||||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: test-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
setup:
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- macos-latest
|
||||
- ubuntu-latest
|
||||
- windows-latest
|
||||
cache:
|
||||
- true
|
||||
- false
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: 🏗 Setup repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: 🏗 Setup Expo
|
||||
uses: ./
|
||||
with:
|
||||
eas-version: latest
|
||||
eas-cache: ${{ matrix.cache }}
|
||||
expo-version: latest
|
||||
expo-cache: ${{ matrix.cache }}
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: 🧪 EAS installed
|
||||
run: eas --version
|
||||
|
||||
- name: 🧪 EAS authenticated
|
||||
run: eas whoami
|
||||
|
||||
- name: 🧪 Expo installed
|
||||
run: expo --version
|
||||
|
||||
- name: 🧪 Expo authenticated
|
||||
run: expo whoami
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
# SWC
|
||||
.swc/
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
# Node
|
||||
node_modules
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
package-lock.json
|
||||
|
||||
# Ruby
|
||||
.direnv
|
||||
|
||||
# Emacs
|
||||
*~
|
||||
|
||||
# Vim
|
||||
.*.swp
|
||||
.*.swo
|
||||
.*.swn
|
||||
.*.swm
|
||||
|
||||
# Sublime Text
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
|
||||
# Xcode
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.xccheckout
|
||||
*.xcscmblueprint
|
||||
xcuserdata
|
||||
|
||||
# Android Studio
|
||||
*.iml
|
||||
.gradle
|
||||
.idea/libraries
|
||||
.idea/workspace.xml
|
||||
.idea/gradle.xml
|
||||
.idea/misc.xml
|
||||
.idea/modules.xml
|
||||
.idea/vcs.xml
|
||||
|
||||
# Eclipse
|
||||
.project
|
||||
.settings
|
||||
|
||||
# VSCode
|
||||
.history/
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"printWidth": 120,
|
||||
"tabWidth": 2,
|
||||
"singleQuote": true,
|
||||
"bracketSameLine": true,
|
||||
"trailingComma": "es5",
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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'],
|
||||
tagFormat: '${version}',
|
||||
plugins: [
|
||||
['@semantic-release/commit-analyzer', {
|
||||
preset: 'conventionalcommits',
|
||||
releaseRules: [
|
||||
{ breaking: true, release: 'major' },
|
||||
{ revert: true, release: 'patch' },
|
||||
].concat(
|
||||
rules.map(({ type, release, breaking }) => ({ type, release, breaking }))
|
||||
),
|
||||
}],
|
||||
['@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',
|
||||
],
|
||||
};
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
---
|
||||
language: bash
|
||||
services:
|
||||
- docker
|
||||
env:
|
||||
global:
|
||||
- DOCKER_IMAGE=bycedric/expo-cli
|
||||
- DOCKER_TAG=2
|
||||
script:
|
||||
- docker build base -t $DOCKER_IMAGE:$DOCKER_TAG
|
||||
- docker run -ti --rm $DOCKER_IMAGE:$DOCKER_TAG diagnostics
|
||||
before_deploy:
|
||||
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||
- docker tag $DOCKER_IMAGE:$DOCKER_TAG $DOCKER_IMAGE:latest
|
||||
deploy:
|
||||
provider: script
|
||||
script: docker push $DOCKER_IMAGE:$DOCKER_TAG && docker push $DOCKER_IMAGE:latest
|
||||
on:
|
||||
branch: master
|
||||
+317
@@ -1,3 +1,320 @@
|
||||
## [7.0.0](https://github.com/expo/expo-github-action/compare/6.0.0...7.0.0) (2022-01-13)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* some input options are deprecated
|
||||
- Username and password authentication is dropped in favor of tokens
|
||||
- Custom cache keys are dropped
|
||||
- Custom install error handler is dropped
|
||||
|
||||
### Bug fixes
|
||||
|
||||
* use which instead of npx to authenticate ([#147](https://github.com/expo/expo-github-action/issues/147)) ([c5d2c0f](https://github.com/expo/expo-github-action/commit/c5d2c0f8c034b625147bc4b2ccd6d14a29412a1d))
|
||||
|
||||
|
||||
### Code changes
|
||||
|
||||
* allow multiple entrypoints for different sub-actions ([#121](https://github.com/expo/expo-github-action/issues/121)) ([8a7306a](https://github.com/expo/expo-github-action/commit/8a7306a97854f9b2853a614d3302061922471a8f))
|
||||
* clean up setup action ([#146](https://github.com/expo/expo-github-action/issues/146)) ([439ff4c](https://github.com/expo/expo-github-action/commit/439ff4c9aa508ea6f38364859109267d8f26fcf1))
|
||||
* enable caches by default ([#148](https://github.com/expo/expo-github-action/issues/148)) ([72d4067](https://github.com/expo/expo-github-action/commit/72d406754f3b10aeff9b54a2b3e3e833d4cd3c9f))
|
||||
* replace libnpm with npm cli ([#139](https://github.com/expo/expo-github-action/issues/139)) ([4f28493](https://github.com/expo/expo-github-action/commit/4f28493708de28b8eebd418702ec8eb93660927d))
|
||||
* roll back to ncc because of swc bundling issues ([#144](https://github.com/expo/expo-github-action/issues/144)) ([3007741](https://github.com/expo/expo-github-action/commit/3007741466570f1bf8f3cf7417e56c7aab50b60a))
|
||||
* update the outdated workflows and use node 16 ([#138](https://github.com/expo/expo-github-action/issues/138)) ([3134e26](https://github.com/expo/expo-github-action/commit/3134e26b3a41fcc058c60c0f34f87c8d44189d3c))
|
||||
* upgrade to node 16 github actions runtime ([#137](https://github.com/expo/expo-github-action/issues/137)) ([3bf9181](https://github.com/expo/expo-github-action/commit/3bf9181edb0df2dcaf9112b50c9d2a9996db8a32))
|
||||
* use boolean input instead of manual conversion ([#127](https://github.com/expo/expo-github-action/issues/127)) ([f1fe877](https://github.com/expo/expo-github-action/commit/f1fe8775927c95727008dfe31f580c122913a745))
|
||||
* use spaces for indentation ([#126](https://github.com/expo/expo-github-action/issues/126)) ([ff2ff0f](https://github.com/expo/expo-github-action/commit/ff2ff0f980f70d0047d10637dd5ef915128199ec))
|
||||
* use swc pack instead of ncc ([#140](https://github.com/expo/expo-github-action/issues/140)) ([3f9e947](https://github.com/expo/expo-github-action/commit/3f9e9479631f03a941ecfebdcd0351ef57f59a2e))
|
||||
|
||||
|
||||
### Other chores
|
||||
|
||||
* add basic e2e test workflow for main action ([#141](https://github.com/expo/expo-github-action/issues/141)) ([414c169](https://github.com/expo/expo-github-action/commit/414c1693e6183ad92723fca4517181b21f93eaf0))
|
||||
* add manual trigger to the tests ([4908a48](https://github.com/expo/expo-github-action/commit/4908a48f1b5e1ccff9589c0fcaafe4223d53bee1))
|
||||
* always use lf for build files ([#122](https://github.com/expo/expo-github-action/issues/122)) ([a9b9cfe](https://github.com/expo/expo-github-action/commit/a9b9cfef50ba2c1d38fff1a679c554eb52edc25e))
|
||||
* bump semver-regex from 3.1.2 to 3.1.3 ([#114](https://github.com/expo/expo-github-action/issues/114)) ([50c0ef9](https://github.com/expo/expo-github-action/commit/50c0ef9028d51bd25197c54102438f494c265438))
|
||||
* bump tar from 4.4.13 to 4.4.19 ([#112](https://github.com/expo/expo-github-action/issues/112)) ([5f5673b](https://github.com/expo/expo-github-action/commit/5f5673ba7744a05d9c499fbca7b4e503aabef5a1))
|
||||
* bump tmpl from 1.0.4 to 1.0.5 ([#115](https://github.com/expo/expo-github-action/issues/115)) ([92ec93f](https://github.com/expo/expo-github-action/commit/92ec93fa37744783ec10149e7d755d7181649f8a))
|
||||
* clean up dependencies and eslint rules ([#145](https://github.com/expo/expo-github-action/issues/145)) ([3ae7999](https://github.com/expo/expo-github-action/commit/3ae799926e78cfecd54e965c77d1c1fb49cac45b))
|
||||
* clean up master references in release and workflows ([#104](https://github.com/expo/expo-github-action/issues/104)) ([a2d9b1c](https://github.com/expo/expo-github-action/commit/a2d9b1cadf463af1e6b4025af3edc99cf7f4b5a0))
|
||||
* clean up tsconfig and eslint rules ([#123](https://github.com/expo/expo-github-action/issues/123)) ([c20146f](https://github.com/expo/expo-github-action/commit/c20146f3b7513ae3a3df3dead651d2a2dea988af))
|
||||
* lint root files with prettier and eslint ([#125](https://github.com/expo/expo-github-action/issues/125)) ([1cfa7bb](https://github.com/expo/expo-github-action/commit/1cfa7bbd9ed623e2e40406addab4bff2c9a7b2fd))
|
||||
* rebuild project ([45b79a0](https://github.com/expo/expo-github-action/commit/45b79a05ef7496339d33d03fdd7755ef76c7038b))
|
||||
* rebuild project after dependency bumps ([b099f17](https://github.com/expo/expo-github-action/commit/b099f17d588e23df069b60d39ca1e21327066a4f))
|
||||
* remove husky and improve ci build message ([#128](https://github.com/expo/expo-github-action/issues/128)) ([39b0d36](https://github.com/expo/expo-github-action/commit/39b0d361f7d97ef1a71a02495463d1e93a72093a))
|
||||
* simplify review and update build detection ([#142](https://github.com/expo/expo-github-action/issues/142)) ([ee415b0](https://github.com/expo/expo-github-action/commit/ee415b027afce4c15cabcc6fa2f8368530a36c08))
|
||||
* update `setup-node` action to `v2` release ([#119](https://github.com/expo/expo-github-action/issues/119)) ([3b3e6b8](https://github.com/expo/expo-github-action/commit/3b3e6b8031b898cdf0bc59488d541d90748954b9))
|
||||
* update the action manifest ([633cdf0](https://github.com/expo/expo-github-action/commit/633cdf0ac9f283f5a7010fef11bfda9174278054))
|
||||
* upgrade dev dependencies and rebuild action ([#120](https://github.com/expo/expo-github-action/issues/120)) ([186ef00](https://github.com/expo/expo-github-action/commit/186ef0011a259a7b2c745f8cf2743358ca112530))
|
||||
|
||||
|
||||
### Documentation changes
|
||||
|
||||
* fix broken sup element in readme ([0b1822a](https://github.com/expo/expo-github-action/commit/0b1822a93580171a0582013a0cf7848cf3503ed7))
|
||||
* fix github capitalization ([#116](https://github.com/expo/expo-github-action/issues/116)) ([b602469](https://github.com/expo/expo-github-action/commit/b60246939fba50e600b11596b4b1029091017b7c))
|
||||
* fix unsplash comment on pr branch reference ([#110](https://github.com/expo/expo-github-action/issues/110)) ([f14253e](https://github.com/expo/expo-github-action/commit/f14253ea9c17296e843610c7b8fad4e13c7abda0))
|
||||
* update expo.io links to expo.dev ([#111](https://github.com/expo/expo-github-action/issues/111)) ([1c8e5a2](https://github.com/expo/expo-github-action/commit/1c8e5a21e9689cedd8fbcf61e50a3f4700b6bc41))
|
||||
* update node version reference in readme ([#107](https://github.com/expo/expo-github-action/issues/107)) ([3ba667b](https://github.com/expo/expo-github-action/commit/3ba667b43f1e103a1c64e92a60d7c36bd0ad10b2))
|
||||
* update readme and contributing guides ([521de72](https://github.com/expo/expo-github-action/commit/521de724fcb79235773c077e870d7c2293ab51cb))
|
||||
* use `main` branch to update `v{major}` tag ([#103](https://github.com/expo/expo-github-action/issues/103)) ([def44e2](https://github.com/expo/expo-github-action/commit/def44e2c77a39f5bd48dbb07adec509137afcf67))
|
||||
|
||||
## [6.0.0](https://github.com/expo/expo-github-action/compare/5.5.1...6.0.0) (2021-06-22)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* GitHub Action inputs are changed to allow both Expo and EAS CLI.
|
||||
|
||||
### New features
|
||||
|
||||
* add support for eas cli installs ([#98](https://github.com/expo/expo-github-action/issues/98)) ([04692c3](https://github.com/expo/expo-github-action/commit/04692c3cb1f7ad977f62841ca0bb175c903f653f))
|
||||
|
||||
|
||||
### Other chores
|
||||
|
||||
* update node to 14 and 16 in ci ([#100](https://github.com/expo/expo-github-action/issues/100)) ([a03876e](https://github.com/expo/expo-github-action/commit/a03876e3c556bea147f2be007eac911bf78c9b23))
|
||||
|
||||
|
||||
### Documentation changes
|
||||
|
||||
* add commands to contirbuting guide for updating v{major} tags ([1b57c37](https://github.com/expo/expo-github-action/commit/1b57c37e9bdfe92e183befb3595debc64da672f0))
|
||||
* update readme for v6 release ([#101](https://github.com/expo/expo-github-action/issues/101)) ([8b43bae](https://github.com/expo/expo-github-action/commit/8b43bae073f280d4fa76aa174642ad46febe985c))
|
||||
* update upstream reference in contributing guide ([76ce4de](https://github.com/expo/expo-github-action/commit/76ce4de80ea89b343404cdabadc922882af80487))
|
||||
|
||||
### [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))
|
||||
|
||||
## [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))
|
||||
|
||||
## [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
|
||||
|
||||
@@ -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 changes 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.
|
||||
|
||||
If your PR is ready, run the **test** workflow to test the workflows on all supported OS system.
|
||||
|
||||
## 📝 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 main
|
||||
$ git fetch --tags && git pull
|
||||
$ git tag --force v{major}
|
||||
$ git push --force --tags
|
||||
```
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
FROM bycedric/expo-cli:2
|
||||
|
||||
LABEL com.github.actions.name="Expo CLI"
|
||||
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"]
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
# 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
|
||||
|
||||
@@ -1,156 +1,221 @@
|
||||
# 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>Publish, build or manage your <a href="https://github.com/expo/expo">Expo</a> app with GitHub Actions!</p>
|
||||
<p>
|
||||
<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/main.svg?style=flat-square" alt="builds" />
|
||||
</a>
|
||||
<a href="https://github.com/expo/expo-github-action/blob/main/LICENSE.md">
|
||||
<img src="https://img.shields.io/github/license/expo/expo-github-action?style=flat-square" alt="license" />
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/expo/expo-github-action#configuration-options"><b>Usage</b></a>
|
||||
—
|
||||
<a href="https://github.com/expo/expo-github-action#example-workflows"><b>Examples</b></a>
|
||||
—
|
||||
<a href="https://github.com/expo/expo-github-action#things-to-know"><b>Caveats</b></a>
|
||||
—
|
||||
<a href="https://github.com/expo/expo-github-action/blob/main/CHANGELOG.md"><b>Changelog</b></a>
|
||||
</p>
|
||||
</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 [Expo CLI][link-expo-cli] and [EAS CLI][link-eas-cli].
|
||||
It allows you to fully automate the `expo publish` or `eas 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-version` | `''` | [Expo CLI](https://github.com/expo/expo-cli) version to install, skips when omitted. |
|
||||
| `expo-cache` | `true` | If it should use the [GitHub actions cache](#using-the-built-in-cache). |
|
||||
| `eas-version` | `''` | [EAS CLI](https://github.com/expo/eas-cli) version to install, skips when omitted. |
|
||||
| `eas-cache` | `true` | If it should use the [GitHub actions cache](#using-the-built-in-cache). |
|
||||
| `packager` | `yarn` | The package manager to use. _(e.g. `yarn` or `npm`)_ |
|
||||
| `token` | `''` | The token of your Expo account |
|
||||
| `patch-watchers` | `true` | If it should [patch the `fs.inotify.` limits](#enospc-errors-on-linux). |
|
||||
|
||||
### Used secrets
|
||||
> Never hardcode `expo-token` 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.
|
||||
> Using `latest` for `eas-version` is recommened, you should always have the latest version of this CLI installed.
|
||||
|
||||
## 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 main](#publish-on-any-push-to-main)
|
||||
2. [Creating a new EAS build](#creating-a-new-eas-build)
|
||||
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-node-versions-and-systems)
|
||||
|
||||
### Publish on any push
|
||||
### Publish on any push to main
|
||||
|
||||
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 main branch is updated.
|
||||
The workflow listens to the `push` event and sets up Node 14 using the [Setup Node Action][link-actions-node].
|
||||
It also auto-authenticates when the `token` is provided.
|
||||
|
||||
```hcl
|
||||
workflow "Install and Publish" {
|
||||
on = "push"
|
||||
resolves = ["Publish"]
|
||||
}
|
||||
|
||||
action "Install" {
|
||||
uses = "actions/npm@master"
|
||||
args = "install"
|
||||
}
|
||||
|
||||
action "Publish" {
|
||||
needs = "Install"
|
||||
uses = "expo/[email protected]"
|
||||
args = "publish"
|
||||
secrets = ["EXPO_CLI_USERNAME", "EXPO_CLI_PASSWORD"]
|
||||
}
|
||||
```yml
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
- uses: expo/expo-github-action@v6
|
||||
with:
|
||||
expo-version: 5.x
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
- run: yarn install
|
||||
- run: expo publish
|
||||
```
|
||||
|
||||
### Publish on a specific branch
|
||||
### Creating a new EAS build
|
||||
|
||||
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.
|
||||
You can also install [EAS](https://docs.expo.dev/eas/) CLI with this GitHub Action.
|
||||
Below we've swapped `expo-version` with `eas-version`, but you can also use them together.
|
||||
Both the `token` and `username`/`password` is shared between both Expo and EAS CLI.
|
||||
|
||||
```hcl
|
||||
workflow "Install and Publish" {
|
||||
on = "push"
|
||||
resolves = ["Publish"]
|
||||
}
|
||||
> We recommend using `latest` for `eas-version` to always have the most up-to-date version.
|
||||
|
||||
action "Install" {
|
||||
uses = "actions/npm@master"
|
||||
args = "install"
|
||||
}
|
||||
|
||||
action "Test" {
|
||||
needs = "Install"
|
||||
uses = "actions/npm@master"
|
||||
args = "test"
|
||||
}
|
||||
|
||||
action "Filter branch" {
|
||||
needs = "Test"
|
||||
uses = "actions/bin/filter@master"
|
||||
args = "branch master"
|
||||
}
|
||||
|
||||
action "Publish" {
|
||||
needs = "Filter branch"
|
||||
uses = "expo/[email protected]"
|
||||
args = "publish"
|
||||
secrets = ["EXPO_CLI_USERNAME", "EXPO_CLI_PASSWORD"]
|
||||
}
|
||||
```yml
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
- uses: expo/expo-github-action@v6
|
||||
with:
|
||||
eas-version: latest
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
- run: yarn install
|
||||
- run: eas build
|
||||
```
|
||||
|
||||
### Test and build web every day at 08:00
|
||||
### Test PRs and publish a review version
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
> 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/npm@master"
|
||||
args = "install"
|
||||
}
|
||||
|
||||
action "Test" {
|
||||
needs = "Install"
|
||||
uses = "actions/npm@master"
|
||||
args = "test"
|
||||
}
|
||||
|
||||
action "Publish" {
|
||||
needs = "Test"
|
||||
uses = "expo/[email protected]"
|
||||
args = "build:web"
|
||||
}
|
||||
```yml
|
||||
on: [pull_request]
|
||||
env:
|
||||
projectOwner: bycedric
|
||||
projectSlug: use-expo
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: yarn
|
||||
- uses: expo/expo-github-action@v6
|
||||
with:
|
||||
expo-version: 5.x
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
- run: yarn install
|
||||
- run: expo publish --release-channel=pr-${{ github.event.number }}
|
||||
- uses: unsplash/[email protected]
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
msg: App is ready for review, you can [see it here](https://expo.dev/@${{ env.projectOwner }}/${{ env.projectSlug }}?release-channel=pr-${{ github.event.number }}).\n\n<img src="https://qr.expo.dev/expo-go?owner=${{ env.projectOwner }}&slug=${{ env.projectSlug }}&releaseChannel=pr-${{ github.event.number }}" height="200px" width="200px"></a>
|
||||
```
|
||||
|
||||
## License
|
||||
### Test PRs on multiple node versions and systems
|
||||
|
||||
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
|
||||
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 `token` variables.
|
||||
|
||||
<p align="center">
|
||||
with :heart: <a href="https://bycedric.com" target="_blank">byCedric</a>
|
||||
</p>
|
||||
```yml
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest, windows-latest]
|
||||
node: [14.x, 16.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
cache: yarn
|
||||
- uses: expo/expo-github-action@v6
|
||||
with:
|
||||
expo-version: 5.x
|
||||
- run: yarn install
|
||||
- run: yarn test
|
||||
- run: expo doctor
|
||||
```
|
||||
|
||||
[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
|
||||
## Things to know
|
||||
|
||||
### Automatic Expo login
|
||||
|
||||
You need to authenticate for some Expo commands like `expo publish` and `expo build`.
|
||||
This action can export the `EXPO_TOKEN` variable to access it in every step.
|
||||
|
||||
> Note, this action does not store the token anywhere. For every seperate job, you need to setup the token.
|
||||
|
||||
### Using the built-in cache
|
||||
|
||||
Caching is enabled by default to speed up consecutive CLI installs, but you can still opt-out to this.
|
||||
Under the hood, it uses the [`@actions/cache`][link-actions-cache-package] package to restore the CLI installation.
|
||||
This action generates a unique cache key for the OS, used packager, and exact version of the CLI.
|
||||
|
||||
> Note, this cache will count towards your [repo cache limit][link-actions-cache-limit]. The Expo and EAS CLI are stored in different caches.
|
||||
|
||||
### 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 `patch-watchers` to `false`.
|
||||
|
||||
<div align="center">
|
||||
<br />
|
||||
with :heart: <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://github.com/actions/toolkit/tree/main/packages/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.dev/workflow/expo-cli/
|
||||
[link-expo-release-channels]: https://docs.expo.dev/distribution/release-channels/
|
||||
[link-eas-cli]: https://github.com/expo/eas-cli#readme
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
---
|
||||
name: Expo GitHub Action
|
||||
author: Cedric van Putten <[email protected]>
|
||||
description: Publish, build or manage your Expo app with GitHub Actions
|
||||
branding:
|
||||
icon: terminal
|
||||
color: gray-dark
|
||||
runs:
|
||||
using: node16
|
||||
main: build/setup/index.js
|
||||
inputs:
|
||||
expo-version:
|
||||
description: Expo CLI version to install
|
||||
expo-cache:
|
||||
description: If Expo CLI should be cached to speed up installation
|
||||
default: true
|
||||
eas-version:
|
||||
description: EAS CLI version to install
|
||||
eas-cache:
|
||||
description: If EAS CLI should be cached to speed up installation
|
||||
default: true
|
||||
packager:
|
||||
description: The package manager used to install the CLIs
|
||||
default: yarn
|
||||
patch-watchers:
|
||||
description: If the action should patch the ENOSPC errors
|
||||
default: true
|
||||
token:
|
||||
description: Your Expo token, for authentication. (use with secrets)
|
||||
# Below are deprecated and won't be supported anymore
|
||||
eas-cache-key:
|
||||
description: A custom remote cache key to use for EAS CLI.
|
||||
deprecationMessage: Custom cache keys are deprecated and not used anymore.
|
||||
expo-cache-key:
|
||||
description: A custom remote cache key to use for Expo CLI.
|
||||
deprecationMessage: Custom cache keys are deprecated and not used anymore.
|
||||
username:
|
||||
description: Your Expo username, for authentication.
|
||||
deprecationMessage: Username/password authentication is deprecated, use a token instead.
|
||||
password:
|
||||
description: Your Expo password, for authentication. (use with secrets)
|
||||
deprecationMessage: Username/password authentication is deprecated, use a token instead.
|
||||
@@ -1,14 +0,0 @@
|
||||
FROM node:10
|
||||
|
||||
LABEL name="Expo for Docker"
|
||||
LABEL repository="https://github.com/expo/expo-github-action"
|
||||
LABEL homepage="https://github.com/expo/expo-github-action/blob/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"]
|
||||
@@ -1,22 +0,0 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 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
|
||||
> 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.
|
||||
@@ -1,40 +0,0 @@
|
||||
# Expo for Docker
|
||||
|
||||
[](https://travis-ci.com/expo/expo-github-action)
|
||||
|
||||
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.
|
||||
To make sure this image stays up to date, Travis CI is scheduled to run weekly builds.
|
||||
|
||||
- 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/expo-cli
|
||||
$ docker run --rm bycedric/expo-cli pubish
|
||||
$ docker run --rm -ti bycedric/expo-cli login
|
||||
$ docker run --rm -ti --entrypoint sh bycedric/expo-cli
|
||||
```
|
||||
|
||||
> 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
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh -l
|
||||
|
||||
set -e
|
||||
sh -c "expo $*"
|
||||
+65201
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -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 $*"
|
||||
@@ -0,0 +1,11 @@
|
||||
/** @type {import('@jest/types').Config.InitialOptions} */
|
||||
module.exports = {
|
||||
verbose: true,
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest',
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,52 @@
|
||||
const ncc = require('@vercel/ncc');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
build();
|
||||
|
||||
async function build() {
|
||||
const actionsDir = path.resolve(__dirname, 'src/actions');
|
||||
const buildDir = path.resolve(__dirname, 'build');
|
||||
|
||||
const actions = fs
|
||||
.readdirSync(actionsDir, { withFileTypes: true })
|
||||
.filter(entity => entity.isFile())
|
||||
.map(entity => ({
|
||||
name: path.basename(entity.name, path.extname(entity.name)),
|
||||
file: path.resolve(actionsDir, entity.name),
|
||||
}));
|
||||
|
||||
for (const action of actions) {
|
||||
const files = await compile(action.file);
|
||||
write(files, path.resolve(buildDir, action.name));
|
||||
|
||||
console.log(`✓ ${path.relative(__dirname, action.file)}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function compile(entry) {
|
||||
const { code, map, assets } = await ncc(entry, {
|
||||
cache: false,
|
||||
license: 'license.txt',
|
||||
quiet: true,
|
||||
});
|
||||
|
||||
return {
|
||||
...assets,
|
||||
'index.js': { source: code },
|
||||
'index.js.map': { source: map },
|
||||
};
|
||||
}
|
||||
|
||||
function write(files, dir) {
|
||||
for (const fileName in files) {
|
||||
if (!files[fileName].source) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const filePath = path.resolve(dir, fileName);
|
||||
|
||||
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
||||
fs.writeFileSync(filePath, files[fileName].source, { encoding: 'utf-8' });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"private": true,
|
||||
"name": "expo-github-action",
|
||||
"version": "7.0.0",
|
||||
"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": "eslint .",
|
||||
"build": "node ncc.js",
|
||||
"clean": "rimraf build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": "^1.0.8",
|
||||
"@actions/core": "^1.6.0",
|
||||
"@actions/exec": "^1.1.0",
|
||||
"@actions/io": "^1.1.1",
|
||||
"@actions/tool-cache": "^1.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@semantic-release/changelog": "^6.0.1",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@tsconfig/node16": "^1.0.2",
|
||||
"@types/jest": "^27.4.0",
|
||||
"@types/node": "^16.11.19",
|
||||
"@typescript-eslint/eslint-plugin": "^5.9.1",
|
||||
"@typescript-eslint/parser": "^5.9.1",
|
||||
"@vercel/ncc": "^0.33.1",
|
||||
"conventional-changelog-conventionalcommits": "^4.6.3",
|
||||
"eslint": "^8.6.0",
|
||||
"eslint-config-universe": "^10.0.0",
|
||||
"jest": "^27.4.7",
|
||||
"prettier": "^2.5.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"semantic-release": "^18.0.1",
|
||||
"ts-jest": "^27.1.2",
|
||||
"typescript": "^4.5.4"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import { getBooleanInput, getInput, group, info } from '@actions/core';
|
||||
|
||||
import { restoreFromCache, saveToCache } from '../cacher';
|
||||
import { installPackage, resolvePackage } from '../packager';
|
||||
import { executeAction, expoAuthenticate, findTool, installToolFromPackage, patchWatchers } from '../worker';
|
||||
|
||||
// Auto-execute in GitHub actions
|
||||
executeAction(setupAction);
|
||||
|
||||
export type SetupInput = ReturnType<typeof setupInput>;
|
||||
|
||||
export function setupInput() {
|
||||
return {
|
||||
easCache: !getInput('eas-cache') || getBooleanInput('eas-cache'),
|
||||
easVersion: getInput('eas-version'),
|
||||
expoCache: !getInput('expo-cache') || getBooleanInput('expo-cache'),
|
||||
expoVersion: getInput('expo-version'),
|
||||
packager: getInput('packager') || 'yarn',
|
||||
patchWatchers: !getInput('patch-watchers') || getBooleanInput('patch-watchers'),
|
||||
token: getInput('token'),
|
||||
};
|
||||
}
|
||||
|
||||
export async function setupAction(input: SetupInput = setupInput()): Promise<void> {
|
||||
if (!input.expoVersion) {
|
||||
info(`Skipped installing expo-cli: 'expo-version' not provided.`);
|
||||
} else {
|
||||
const version = await resolvePackage('expo-cli', input.expoVersion);
|
||||
const message = input.expoCache
|
||||
? `Installing expo-cli (${version}) from cache or with ${input.packager}`
|
||||
: `Installing expo-cli (${version}) with ${input.packager}`;
|
||||
|
||||
await group(message, () => installCli('expo-cli', version, input.packager, input.expoCache));
|
||||
}
|
||||
|
||||
if (!input.easVersion) {
|
||||
info(`Skipped installing eas-cli: 'eas-version' not provided.`);
|
||||
} else {
|
||||
const version = await resolvePackage('eas-cli', input.easVersion);
|
||||
const message = input.easCache
|
||||
? `Installing eas-cli (${version}) from cache or with ${input.packager}`
|
||||
: `Installing eas-cli (${version}) with ${input.packager}`;
|
||||
|
||||
await group(message, () => installCli('eas-cli', input.easVersion, input.packager, input.easCache));
|
||||
}
|
||||
|
||||
if (!input.token) {
|
||||
info(`Skipped authentication: 'token' not provided.`);
|
||||
} else {
|
||||
await group('Validating authenticated account', () =>
|
||||
expoAuthenticate(input.token, input.easVersion ? 'eas' : input.expoVersion ? 'expo' : undefined)
|
||||
);
|
||||
}
|
||||
|
||||
if (!input.patchWatchers) {
|
||||
info(`Skipped patching watchers: 'patch-watchers' disabled.`);
|
||||
} else {
|
||||
await group(`Patching system watchers for the 'ENOSPC' error`, patchWatchers);
|
||||
}
|
||||
}
|
||||
|
||||
async function installCli(name: string, version: string, packager: string, cache: boolean = true) {
|
||||
const cliVersion = await resolvePackage(name, version);
|
||||
let cliPath = findTool(name, cliVersion) || undefined;
|
||||
|
||||
if (!cliPath && cache) {
|
||||
cliPath = await restoreFromCache(name, cliVersion, packager);
|
||||
}
|
||||
|
||||
if (!cliPath) {
|
||||
cliPath = await installPackage(name, cliVersion, packager);
|
||||
|
||||
if (cache) {
|
||||
await saveToCache(name, cliVersion, packager);
|
||||
}
|
||||
}
|
||||
|
||||
installToolFromPackage(cliPath);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { saveCache, restoreCache, ReserveCacheError } from '@actions/cache';
|
||||
import { warning } from '@actions/core';
|
||||
import os from 'os';
|
||||
|
||||
import { toolPath } from './worker';
|
||||
|
||||
/**
|
||||
* Get the exact cache key for the package.
|
||||
* We can prefix this when there are breaking changes in this action.
|
||||
*/
|
||||
export function cacheKey(name: string, version: string, manager: string): string {
|
||||
return `${name}-${process.platform}-${os.arch()}-${manager}-${version}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore a tool from the remote cache.
|
||||
* This will install the tool back into the local tool cache.
|
||||
*/
|
||||
export async function restoreFromCache(name: string, version: string, manager: string) {
|
||||
const dir = toolPath(name, version)!;
|
||||
try {
|
||||
if (await restoreCache([dir], cacheKey(name, version, manager))) {
|
||||
return dir;
|
||||
}
|
||||
} catch (error) {
|
||||
handleCacheError(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a tool to the remote cache.
|
||||
* This will fetch the tool from the local tool cache.
|
||||
*/
|
||||
export async function saveToCache(name: string, version: string, manager: string) {
|
||||
try {
|
||||
await saveCache([toolPath(name, version)], cacheKey(name, version, manager));
|
||||
} catch (error) {
|
||||
handleCacheError(error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to handle incoming cache errors.
|
||||
* Because workers can operate in environments without cache configured,
|
||||
* we need to make sure to only skip the cache instead of fail.
|
||||
*
|
||||
* Currently we handle these types of errors:
|
||||
* - ReserveCacheError
|
||||
* - "cache service url not found"
|
||||
*/
|
||||
export function handleCacheError(error: Error): void {
|
||||
const isReserveCacheError = error instanceof ReserveCacheError;
|
||||
const isCacheUnavailable = error.message.toLowerCase().includes('cache service url not found');
|
||||
|
||||
if (isReserveCacheError || isCacheUnavailable) {
|
||||
warning('Skipped remote cache, encountered error:');
|
||||
warning(error.message);
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { exec } from '@actions/exec';
|
||||
import { which, mkdirP } from '@actions/io';
|
||||
|
||||
import { cacheTool, tempPath } from './worker';
|
||||
|
||||
/**
|
||||
* Resolve a package with version range to an exact version.
|
||||
* This is useful to invalidate the cache _and_ using dist-tags or version ranges.
|
||||
* It executes `npm info` and parses the latest manifest.
|
||||
*/
|
||||
export async function resolvePackage(name: string, range: string): Promise<string> {
|
||||
let stdout = '';
|
||||
|
||||
try {
|
||||
await exec('npm', ['info', `${name}@${range}`, 'version', '--json'], {
|
||||
silent: true,
|
||||
listeners: {
|
||||
stdout(data) {
|
||||
stdout += data.toString();
|
||||
},
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
throw new Error(`Could not resolve ${name}@${range}, reason:\n${error.message || error}`);
|
||||
}
|
||||
|
||||
// thanks npm, for returning a "x.x.x" json value...
|
||||
if (stdout.startsWith('"')) {
|
||||
stdout = `[${stdout}]`;
|
||||
}
|
||||
|
||||
return JSON.parse(stdout).at(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install a module using a node package manager.
|
||||
* The installation is executed in a temporary folder.
|
||||
* After this is complete, it's "installed" into the worker's tool cache.
|
||||
*/
|
||||
export async function installPackage(name: string, version: string, manager: string) {
|
||||
const temp = tempPath(name, version);
|
||||
const tool = await which(manager);
|
||||
|
||||
await mkdirP(temp);
|
||||
await exec(tool, ['add', `${name}@${version}`], { cwd: temp });
|
||||
|
||||
return cacheTool(temp, name, version);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
import { addPath, exportVariable, info, setFailed, warning } from '@actions/core';
|
||||
import { exec } from '@actions/exec';
|
||||
import { which } from '@actions/io';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
export { find as findTool, cacheDir as cacheTool } from '@actions/tool-cache';
|
||||
|
||||
export function tempPath(name: string, version: string): string {
|
||||
const temp = process.env['RUNNER_TEMP'] || '';
|
||||
if (!temp) {
|
||||
throw new Error(`Could not resolve temporary path, 'RUNNER_TEMP' not defined.`);
|
||||
}
|
||||
|
||||
return path.join(temp, name, version, os.arch());
|
||||
}
|
||||
|
||||
export function toolPath(name: string, version: string): string {
|
||||
const toolCache = process.env['RUNNER_TOOL_CACHE'] || '';
|
||||
if (!toolCache) {
|
||||
throw new Error(`Could not resolve the local tool cache, 'RUNNER_TOOL_CACHE' not defined.`);
|
||||
}
|
||||
|
||||
// https://github.com/actions/toolkit/blob/daf8bb00606d37ee2431d9b1596b88513dcf9c59/packages/tool-cache/src/tool-cache.ts#L747-L749
|
||||
return path.join(toolCache, name, version, os.arch());
|
||||
}
|
||||
|
||||
/**
|
||||
* Install a "tool" from a node package.
|
||||
* This will add the folder, containing the `node_modules`, to the global path.
|
||||
*/
|
||||
export function installToolFromPackage(dir: string) {
|
||||
return addPath(path.join(dir, 'node_modules', '.bin'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to patch Linux's inotify limits to a more sensible setting on Linux.
|
||||
* This limitation could cause `ENOSPC` errors when bundling Expo or React Native projects.
|
||||
*
|
||||
* It will try to change these `fs.inotify.` limits:
|
||||
* - .max_user_instances = 524288
|
||||
* - .max_user_watches = 524288
|
||||
* - .max_queued_events = 524288
|
||||
*
|
||||
* @see https://github.com/expo/expo-github-action/issues/20
|
||||
*/
|
||||
export async function patchWatchers(): Promise<void> {
|
||||
if (process.platform !== 'linux') {
|
||||
return info('Skipped patching watchers: not running on Linux.');
|
||||
}
|
||||
|
||||
try {
|
||||
// see https://github.com/expo/expo-cli/issues/277#issuecomment-452685177
|
||||
await exec('sudo sysctl fs.inotify.max_user_instances=524288');
|
||||
await exec('sudo sysctl fs.inotify.max_user_watches=524288');
|
||||
await exec('sudo sysctl fs.inotify.max_queued_events=524288');
|
||||
await exec('sudo sysctl -p');
|
||||
info('Patched system watchers for the `ENOSPC` error.');
|
||||
} catch (error) {
|
||||
warning(`Looks like we can't patch watchers/inotify limits, you might encouter the 'ENOSPC' error.`);
|
||||
warning('For more info: https://github.com/expo/expo-github-action/issues/20, encountered error:');
|
||||
warning(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to authenticate the user using either Expo or EAS CLI.
|
||||
* This method tries to invoke 'whoami' to validate if the token is valid.
|
||||
* If that passes, the token is exported as EXPO_TOKEN for all steps within the job.
|
||||
*/
|
||||
export async function expoAuthenticate(token: string, cli?: 'expo' | 'eas'): Promise<void> {
|
||||
if (!cli) {
|
||||
info(`Skipped token validation: no CLI installed, can't run 'whoami'.`);
|
||||
} else {
|
||||
await exec(await which(cli), ['whoami'], {
|
||||
env: { ...process.env, EXPO_TOKEN: token },
|
||||
});
|
||||
}
|
||||
|
||||
exportVariable('EXPO_TOKEN', token);
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto-execute the action if it's not running in a test environment.
|
||||
* This also propagate possible errors to GitHub actions, with setFailed.
|
||||
*/
|
||||
export async function executeAction(action: () => Promise<void>) {
|
||||
if (process.env.JEST_WORKER_ID) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
|
||||
return action().catch(setFailed);
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
import { SetupInput, setupInput, setupAction } from '../../src/actions/setup';
|
||||
import * as cacher from '../../src/cacher';
|
||||
import * as packager from '../../src/packager';
|
||||
import * as worker from '../../src/worker';
|
||||
import { mockInput } from '../utils';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('../../src/cacher');
|
||||
jest.mock('../../src/packager');
|
||||
jest.mock('../../src/worker');
|
||||
|
||||
describe(setupInput, () => {
|
||||
it('returns object with correct defaults', () => {
|
||||
expect(setupInput()).toMatchObject({
|
||||
easCache: true,
|
||||
easVersion: undefined,
|
||||
expoCache: true,
|
||||
expoVersion: undefined,
|
||||
packager: 'yarn',
|
||||
patchWatchers: true,
|
||||
token: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
it('returns expo version and cache', () => {
|
||||
mockInput({ 'expo-version': '5.x', 'expo-cache': 'true' });
|
||||
expect(setupInput()).toMatchObject({ expoVersion: '5.x', expoCache: true });
|
||||
});
|
||||
|
||||
it('returns eas version and cache', () => {
|
||||
mockInput({ 'eas-version': 'latest', 'eas-cache': 'true' });
|
||||
expect(setupInput()).toMatchObject({ easVersion: 'latest', easCache: true });
|
||||
});
|
||||
|
||||
it('returns different packager', () => {
|
||||
mockInput({ packager: 'npm' });
|
||||
expect(setupInput()).toMatchObject({ packager: 'npm' });
|
||||
});
|
||||
|
||||
it('returns disabled patch watchers', () => {
|
||||
mockInput({ 'patch-watchers': 'false' });
|
||||
expect(setupInput()).toMatchObject({ patchWatchers: false });
|
||||
});
|
||||
|
||||
it('returns token', () => {
|
||||
mockInput({ token: 'faketoken' });
|
||||
expect(setupInput()).toMatchObject({ token: 'faketoken' });
|
||||
});
|
||||
});
|
||||
|
||||
describe(setupAction, () => {
|
||||
const input: SetupInput = {
|
||||
easCache: false,
|
||||
easVersion: '',
|
||||
expoCache: false,
|
||||
expoVersion: '',
|
||||
packager: 'yarn',
|
||||
patchWatchers: true,
|
||||
token: '',
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
jest.mocked(core.group).mockImplementation((_, action) => action());
|
||||
});
|
||||
|
||||
['expo', 'eas'].forEach(cli => {
|
||||
const cliName = `${cli}-cli`;
|
||||
const cliVersion = `${cli}Version`;
|
||||
const cliCache = `${cli}Cache`;
|
||||
|
||||
it(`installs ${cliName} using npm`, async () => {
|
||||
jest.mocked(packager.resolvePackage).mockResolvedValue('5.0.3');
|
||||
await setupAction({ ...input, [cliVersion]: '5.x', [cliCache]: false, packager: 'npm' });
|
||||
expect(packager.installPackage).toBeCalledWith(cliName, '5.0.3', 'npm');
|
||||
expect(worker.installToolFromPackage).toBeCalled();
|
||||
});
|
||||
|
||||
it(`installs ${cliName} from cache`, async () => {
|
||||
jest.mocked(packager.resolvePackage).mockResolvedValue('5.0.3');
|
||||
jest.mocked(cacher.restoreFromCache).mockResolvedValue('fake/path');
|
||||
await setupAction({ ...input, [cliVersion]: 'latest', [cliCache]: true });
|
||||
expect(packager.installPackage).not.toBeCalled();
|
||||
expect(worker.installToolFromPackage).toBeCalledWith('fake/path');
|
||||
});
|
||||
});
|
||||
|
||||
it('authenticates token with eas-cli by default', async () => {
|
||||
await setupAction({ ...input, expoVersion: 'latest', easVersion: 'latest', token: 'faketoken' });
|
||||
expect(worker.expoAuthenticate).toBeCalledWith('faketoken', 'eas');
|
||||
});
|
||||
|
||||
it('authenticates token with expo-cli without eas-cli', async () => {
|
||||
await setupAction({ ...input, expoVersion: 'latest', token: 'faketoken' });
|
||||
expect(worker.expoAuthenticate).toBeCalledWith('faketoken', 'expo');
|
||||
});
|
||||
|
||||
it('authenticates token without any cli', async () => {
|
||||
await setupAction({ ...input, token: 'faketoken' });
|
||||
expect(worker.expoAuthenticate).toBeCalledWith('faketoken', undefined);
|
||||
});
|
||||
|
||||
it('patches watchers', async () => {
|
||||
await setupAction({ ...input, patchWatchers: true });
|
||||
expect(worker.patchWatchers).toBeCalled();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
import * as cache from '@actions/cache';
|
||||
import os from 'os';
|
||||
|
||||
import { cacheKey, restoreFromCache, saveToCache } from '../src/cacher';
|
||||
import { toolPath } from '../src/worker';
|
||||
import { resetEnv, setEnv } from './utils';
|
||||
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
|
||||
beforeAll(() => {
|
||||
setEnv('RUNNER_TOOL_CACHE', os.tmpdir());
|
||||
});
|
||||
|
||||
afterAll(resetEnv);
|
||||
|
||||
describe(cacheKey, () => {
|
||||
it('returns contains package name, version, and manager', () => {
|
||||
expect(cacheKey('expo-cli', '5.0.3', 'yarn')).toMatch('expo-cli');
|
||||
expect(cacheKey('expo-cli', '5.0.3', 'yarn')).toMatch('5.0.3');
|
||||
expect(cacheKey('eas-cli', '5.0.3', 'npm')).toMatch('npm');
|
||||
});
|
||||
|
||||
it('contains the os arch type', () => {
|
||||
expect(cacheKey('eas-cli', '5.0.3', 'yarn')).toMatch(os.arch());
|
||||
});
|
||||
|
||||
it('contains the platform type', () => {
|
||||
expect(cacheKey('eas-cli', '5.0.3', 'yarn')).toMatch(process.platform);
|
||||
});
|
||||
});
|
||||
|
||||
describe(restoreFromCache, () => {
|
||||
it('skips when cache is unavailable', async () => {
|
||||
jest.mocked(cache.restoreCache).mockRejectedValue(new Error('Cache service url not found'));
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('throws when cache has unexpected error', async () => {
|
||||
jest.mocked(cache.restoreCache).mockRejectedValue(new Error('Node registry is down'));
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).rejects.toThrow('Node registry is down');
|
||||
});
|
||||
|
||||
it('returns expo-cli path from cache when available', async () => {
|
||||
jest.mocked(cache.restoreCache).mockResolvedValue('fake/path');
|
||||
await expect(restoreFromCache('expo-cli', '5.0.3', 'yarn')).resolves.toBe(toolPath('expo-cli', '5.0.3'));
|
||||
});
|
||||
|
||||
it('returns nothing when cache is empty', async () => {
|
||||
jest.mocked(cache.restoreCache).mockResolvedValue(undefined);
|
||||
await expect(restoreFromCache('eas-cli', '0.46.2', 'npm')).resolves.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe(saveToCache, () => {
|
||||
it('skips when cache is unavailable', async () => {
|
||||
jest.mocked(cache.saveCache).mockRejectedValue(new Error('Cache service url not found'));
|
||||
await expect(saveToCache('expo-cli', '5.0.3', 'yarn')).resolves.toBeUndefined();
|
||||
});
|
||||
|
||||
it('throws when cache has unexpected error', async () => {
|
||||
jest.mocked(cache.saveCache).mockRejectedValue(new Error('Node registry is down'));
|
||||
await expect(saveToCache('expo-cli', '5.0.3', 'yarn')).rejects.toThrow('Node registry is down');
|
||||
});
|
||||
|
||||
it('saves expo-cli to cache when available', async () => {
|
||||
jest.mocked(cache.saveCache).mockResolvedValue(1337);
|
||||
await expect(saveToCache('expo-cli', '5.0.3', 'yarn')).resolves.toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
import { resolvePackage } from '../src/packager';
|
||||
|
||||
describe(resolvePackage, () => {
|
||||
it('resolves expo-cli@^2.0.0 to 2.21.2', async () => {
|
||||
await expect(resolvePackage('expo-cli', '^2.0.0')).resolves.toBe('2.21.2');
|
||||
});
|
||||
|
||||
it('resolves expo-cli@~3.15.0 to 3.15.5', async () => {
|
||||
await expect(resolvePackage('expo-cli', '~3.15.0')).resolves.toBe('3.15.5');
|
||||
});
|
||||
|
||||
it('resolves eas-cli@~0.33.0 to 0.33.1', async () => {
|
||||
await expect(resolvePackage('eas-cli', '~0.33.0')).resolves.toBe('0.33.1');
|
||||
});
|
||||
|
||||
it('resolves expo-cli@latest to a version', async () => {
|
||||
await expect(resolvePackage('expo-cli', 'latest')).resolves.not.toMatch('latest');
|
||||
});
|
||||
|
||||
it('rejects donotpublishthispackageoryouwillbefired with proper error', async () => {
|
||||
await expect(resolvePackage('donotpublishthispackageoryouwillbefired', 'latest')).rejects.toThrow(
|
||||
'Could not resolve'
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,44 @@
|
||||
import * as core from '@actions/core';
|
||||
|
||||
// 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 resetPlatform(): 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 resetEnv(): void {
|
||||
process.env = originalEnv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mock both the input and boolean input methods from `@actions/core`.
|
||||
*/
|
||||
export function mockInput(inputs: Record<string, string> = {}) {
|
||||
jest.mocked(core.getInput).mockImplementation(name => inputs[name]);
|
||||
jest.mocked(core.getBooleanInput).mockImplementation(name => inputs[name] === 'true');
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as io from '@actions/io';
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
|
||||
import {
|
||||
tempPath,
|
||||
toolPath,
|
||||
installToolFromPackage,
|
||||
patchWatchers,
|
||||
expoAuthenticate,
|
||||
executeAction,
|
||||
} from '../src/worker';
|
||||
import { resetEnv, setEnv, setPlatform, resetPlatform } from './utils';
|
||||
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/exec');
|
||||
jest.mock('@actions/io');
|
||||
|
||||
describe(tempPath, () => {
|
||||
afterEach(resetEnv);
|
||||
|
||||
it('throws when RUNNER_TEMP is undefined', () => {
|
||||
setEnv('RUNNER_TEMP', '');
|
||||
expect(tempPath).toThrow(`'RUNNER_TEMP' not defined`);
|
||||
});
|
||||
|
||||
it('returns path with name, version, and arch type', () => {
|
||||
setEnv('RUNNER_TEMP', 'fake/temp');
|
||||
expect(tempPath('expo-cli', '5.0.3')).toBe(path.join('fake', 'temp', 'expo-cli', '5.0.3', os.arch()));
|
||||
});
|
||||
});
|
||||
|
||||
describe(toolPath, () => {
|
||||
afterEach(resetEnv);
|
||||
|
||||
it('throws when RUNNER_TOOL_CACHE is undefined', () => {
|
||||
setEnv('RUNNER_TOOL_CACHE', '');
|
||||
expect(toolPath).toThrow(`'RUNNER_TOOL_CACHE' not defined`);
|
||||
});
|
||||
|
||||
it('returns path with name, version, and arch type', () => {
|
||||
setEnv('RUNNER_TOOL_CACHE', 'fake/tool');
|
||||
expect(toolPath('eas-cli', '0.34.3')).toBe(path.join('fake', 'tool', 'eas-cli', '0.34.3', os.arch()));
|
||||
});
|
||||
});
|
||||
|
||||
describe(installToolFromPackage, () => {
|
||||
it('registers path to <dir>/node_modules/.bin', () => {
|
||||
installToolFromPackage('fake/install');
|
||||
expect(core.addPath).toBeCalledWith(path.join('fake', 'install', 'node_modules', '.bin'));
|
||||
});
|
||||
});
|
||||
|
||||
describe(patchWatchers, () => {
|
||||
afterEach(resetPlatform);
|
||||
|
||||
it('skips patches on windows', async () => {
|
||||
setPlatform('win32');
|
||||
await patchWatchers();
|
||||
expect(exec.exec).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('skips patches on macos', async () => {
|
||||
setPlatform('darwin');
|
||||
await patchWatchers();
|
||||
expect(exec.exec).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('patches on ubuntu', async () => {
|
||||
setPlatform('linux');
|
||||
await patchWatchers();
|
||||
expect(exec.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_instances=524288');
|
||||
expect(exec.exec).toBeCalledWith('sudo sysctl fs.inotify.max_user_watches=524288');
|
||||
expect(exec.exec).toBeCalledWith('sudo sysctl fs.inotify.max_queued_events=524288');
|
||||
expect(exec.exec).toBeCalledWith('sudo sysctl -p');
|
||||
});
|
||||
|
||||
it('handles exception from commands', async () => {
|
||||
setPlatform('linux');
|
||||
jest
|
||||
.mocked(exec.exec)
|
||||
.mockResolvedValueOnce(0)
|
||||
.mockResolvedValueOnce(0)
|
||||
.mockRejectedValueOnce(new Error('fake error'));
|
||||
await expect(patchWatchers()).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe(expoAuthenticate, () => {
|
||||
it('exports EXPO_TOKEN variable', async () => {
|
||||
await expoAuthenticate('faketoken', undefined);
|
||||
expect(core.exportVariable).toBeCalledWith('EXPO_TOKEN', 'faketoken');
|
||||
});
|
||||
|
||||
it('validates EXPO_TOKEN with expo-cli', async () => {
|
||||
jest.mocked(io.which).mockResolvedValue('expo');
|
||||
await expoAuthenticate('faketoken', 'expo');
|
||||
expect(io.which).toBeCalledWith('expo');
|
||||
expect(exec.exec).toBeCalledWith('expo', ['whoami'], {
|
||||
env: expect.objectContaining({ EXPO_TOKEN: 'faketoken' }),
|
||||
});
|
||||
});
|
||||
|
||||
it('validates EXPO_TOKEN with eas-cli', async () => {
|
||||
jest.mocked(io.which).mockResolvedValue('eas');
|
||||
await expoAuthenticate('faketoken', 'eas');
|
||||
expect(io.which).toBeCalledWith('eas');
|
||||
expect(exec.exec).toBeCalledWith('eas', ['whoami'], {
|
||||
env: expect.objectContaining({ EXPO_TOKEN: 'faketoken' }),
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe(executeAction, () => {
|
||||
afterEach(resetEnv);
|
||||
|
||||
it('skips executing action in jest', async () => {
|
||||
const action = jest.fn(() => Promise.resolve());
|
||||
await executeAction(action);
|
||||
expect(action).not.toBeCalled();
|
||||
});
|
||||
|
||||
it('executes action outside jest', async () => {
|
||||
setEnv('JEST_WORKER_ID', '');
|
||||
const action = jest.fn(() => Promise.resolve());
|
||||
await executeAction(action);
|
||||
expect(action).toBeCalled();
|
||||
});
|
||||
|
||||
it('handles action errors', async () => {
|
||||
setEnv('JEST_WORKER_ID', '');
|
||||
const error = new Error('fake error');
|
||||
const action = jest.fn(() => Promise.reject(error));
|
||||
await expect(executeAction(action)).resolves.not.toThrow();
|
||||
expect(core.setFailed).toBeCalledWith(error);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "./node_modules/@tsconfig/node16/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./build",
|
||||
"rootDir": "./src",
|
||||
"useUnknownInCatchVariables": false
|
||||
},
|
||||
"exclude": [
|
||||
"build",
|
||||
"node_modules",
|
||||
"tests/**"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user