Compare commits

..
14 Commits
Author SHA1 Message Date
semantic-release-bot 1bde34e5c7 chore: create new release 7.1.1
### [7.1.1](https://github.com/expo/expo-github-action/compare/7.1.0...7.1.1) (2022-03-17)

### Bug fixes

* package tool escape path on windows ([#169](https://github.com/expo/expo-github-action/issues/169)) ([db9b5ce](https://github.com/expo/expo-github-action/commit/db9b5ce00f55fe6dc5d802d41ffbd6c03cb598e4)), closes [#167](https://github.com/expo/expo-github-action/issues/167)

### Other chores

* add tags syncing to the release workflow ([eb1ffb8](https://github.com/expo/expo-github-action/commit/eb1ffb8b234266a58d5fbfa1343e6fe6adfaf914))
* fix dirty repo preventing tag bump ([7cde8f8](https://github.com/expo/expo-github-action/commit/7cde8f899a0771d310e1d62ee65ce3d625d470ea))

### Documentation changes

* add direct link to expo access tokens ([1f38d16](https://github.com/expo/expo-github-action/commit/1f38d16d01677b6ed60d5358bdf23576538d578b))
* increase visibility of the EXPO_TOKEN link ([#168](https://github.com/expo/expo-github-action/issues/168)) ([9fce70f](https://github.com/expo/expo-github-action/commit/9fce70f38003122ae997201dd07d4cc74830c24e))
* **preview-comment:** update expo-cli version to latest ([4681fcf](https://github.com/expo/expo-github-action/commit/4681fcfc4247a28d47e8dfb17d23a9a0bff22827))
* reword the assumptions on package manager ([459b567](https://github.com/expo/expo-github-action/commit/459b5673d55573b6e620015864c95b6b007f2f5f))
2022-03-17 19:58:47 +00:00
Cedric van Putten 459b5673d5 docs: reword the assumptions on package manager 2022-03-17 18:57:23 +01:00
Cedric van Putten eb1ffb8b23 chore: add tags syncing to the release workflow 2022-03-17 18:54:06 +01:00
Cedric van Putten db9b5ce00f fix: package tool escape path on windows (#169)
* chore: update e2e tests to try npm and macos

This should add more visibility if something is going wrong, like #167.

* test: see if which properly resolves npm on windows

* test: try with execution

* test: try a couple of things including mkdirP and absolute toolpath

* chore: try to pass the name of the packager instead

* chore: remove the test code from the workflow
2022-03-17 18:38:23 +01:00
Evan Bacon 9fce70f380 docs: increase visibility of the EXPO_TOKEN link (#168) 2022-03-17 17:44:35 +01:00
Cedric van Putten 4681fcfc42 docs(preview-comment): update expo-cli version to latest 2022-03-16 08:23:45 -07:00
Cedric van Putten 1f38d16d01 docs: add direct link to expo access tokens 2022-03-09 17:50:37 +01:00
Cedric van Putten 7cde8f899a chore: fix dirty repo preventing tag bump 2022-03-04 09:15:01 -08:00
semantic-release-bot a522d656e4 chore: create new release 7.1.0
## [7.1.0](https://github.com/expo/expo-github-action/compare/7.0.3...7.1.0) (2022-03-04)

### New features

* add projectDeepLink to template variables ([#165](https://github.com/expo/expo-github-action/issues/165)) ([2603f85](https://github.com/expo/expo-github-action/commit/2603f858e975e61d8b7650b890db57c3afc5c658))

### Other chores

* run authed tests only when auth is available ([5815161](https://github.com/expo/expo-github-action/commit/58151613afb24812ce88afb33ed1a6b3f569128e))
* set major tag version to release commit ([b516013](https://github.com/expo/expo-github-action/commit/b5160133d207c9a70283880b33e34beb157cc7ea))
* skip steps if auth is unavailable ([bb7c723](https://github.com/expo/expo-github-action/commit/bb7c72336b557c49ca0a0e84025e1b4cce23ce2e))
* update github action author name ([#166](https://github.com/expo/expo-github-action/issues/166)) ([520d959](https://github.com/expo/expo-github-action/commit/520d9594e099c7b2475d8b376303466a187bcafa))
2022-03-04 17:07:21 +00:00
Cedric van Putten 58151613af chore: run authed tests only when auth is available 2022-03-04 15:46:06 +01:00
Giau. Tran Minh 2603f858e9 feature: add projectDeepLink to template variables (#165)
* feat: added projectDeepLink to template variables

* fix: updates from code review
2022-03-03 15:25:52 -08:00
Cedric van Putten 520d9594e0 chore: update github action author name (#166)
* chore: update default github action author name

* chore: update comment preview github action author name
2022-03-03 10:37:43 -08:00
Cedric van Putten b5160133d2 chore: set major tag version to release commit 2022-03-03 19:35:26 +01:00
Cedric van Putten bb7c72336b chore: skip steps if auth is unavailable
This is especially useful for external PR contributions
2022-03-03 19:26:50 +01:00
14 changed files with 158 additions and 36 deletions

No files matched your search

+3
View File
@@ -84,6 +84,9 @@ jobs:
const semver = require('semver')
const { version } = require('./package.json')
return semver.major(version)
- name: 🧹 Clean repo
run: git checkout . -xdf && git reset --hard HEAD && git pull && git fetch --tags
- name: 📋 Update tags
run: git tag --force v${{ steps.version.outputs.result }} && git push --force --tags
+23 -2
View File
@@ -13,6 +13,9 @@ concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
env:
hasAuth: ${{ !!secrets.EXPO_TOKEN }}
jobs:
setup:
strategy:
@@ -20,9 +23,22 @@ jobs:
os:
- ubuntu-latest
- windows-latest
- macos-latest
cache:
- with-cache
- without-cache
packager:
- yarn
include:
- os: ubuntu-latest
cache: without-cache
packager: npm
- os: windows-latest
cache: without-cache
packager: npm
- os: macos-latest
cache: without-cache
packager: npm
runs-on: ${{ matrix.os }}
steps:
- name: 🏗 Setup repo
@@ -35,18 +51,21 @@ jobs:
eas-cache: ${{ matrix.cache == 'with-cache' }}
expo-version: latest
expo-cache: ${{ matrix.cache == 'with-cache' }}
packager: ${{ matrix.packager }}
token: ${{ secrets.EXPO_TOKEN }}
- name: 🧪 EAS installed
run: eas --version
- name: 🧪 EAS authenticated
if: ${{ env.hasAuth == 'true' }}
run: eas whoami
- name: 🧪 Expo installed
run: expo --version
- name: 🧪 Expo authenticated
if: ${{ env.hasAuth == 'true' }}
run: expo whoami
preview-comment:
@@ -66,6 +85,7 @@ jobs:
run: expo init -t blank ./temp
- name: 🧪 Without commenting
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
id: preview
with:
@@ -73,6 +93,7 @@ jobs:
comment: false
- name: 🧪 Output has content
if: ${{ env.hasAuth == 'true' }}
uses: actions/github-script@v5
with:
script: |
@@ -80,6 +101,7 @@ jobs:
if (!message) throw new Error('Message output is empty')
- name: 🧪 Comment on PR (github-token)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
env:
EXPO_TEST_GITHUB_PULL: 149
@@ -88,6 +110,7 @@ jobs:
channel: test
- name: 🧪 Comment on PR (GITHUB_TOKEN)
if: ${{ env.hasAuth == 'true' }}
uses: ./preview-comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -96,5 +119,3 @@ jobs:
project: ./temp
channel: test
github-token: badtoken
+36
View File
@@ -1,3 +1,39 @@
### [7.1.1](https://github.com/expo/expo-github-action/compare/7.1.0...7.1.1) (2022-03-17)
### Bug fixes
* package tool escape path on windows ([#169](https://github.com/expo/expo-github-action/issues/169)) ([db9b5ce](https://github.com/expo/expo-github-action/commit/db9b5ce00f55fe6dc5d802d41ffbd6c03cb598e4)), closes [#167](https://github.com/expo/expo-github-action/issues/167)
### Other chores
* add tags syncing to the release workflow ([eb1ffb8](https://github.com/expo/expo-github-action/commit/eb1ffb8b234266a58d5fbfa1343e6fe6adfaf914))
* fix dirty repo preventing tag bump ([7cde8f8](https://github.com/expo/expo-github-action/commit/7cde8f899a0771d310e1d62ee65ce3d625d470ea))
### Documentation changes
* add direct link to expo access tokens ([1f38d16](https://github.com/expo/expo-github-action/commit/1f38d16d01677b6ed60d5358bdf23576538d578b))
* increase visibility of the EXPO_TOKEN link ([#168](https://github.com/expo/expo-github-action/issues/168)) ([9fce70f](https://github.com/expo/expo-github-action/commit/9fce70f38003122ae997201dd07d4cc74830c24e))
* **preview-comment:** update expo-cli version to latest ([4681fcf](https://github.com/expo/expo-github-action/commit/4681fcfc4247a28d47e8dfb17d23a9a0bff22827))
* reword the assumptions on package manager ([459b567](https://github.com/expo/expo-github-action/commit/459b5673d55573b6e620015864c95b6b007f2f5f))
## [7.1.0](https://github.com/expo/expo-github-action/compare/7.0.3...7.1.0) (2022-03-04)
### New features
* add projectDeepLink to template variables ([#165](https://github.com/expo/expo-github-action/issues/165)) ([2603f85](https://github.com/expo/expo-github-action/commit/2603f858e975e61d8b7650b890db57c3afc5c658))
### Other chores
* run authed tests only when auth is available ([5815161](https://github.com/expo/expo-github-action/commit/58151613afb24812ce88afb33ed1a6b3f569128e))
* set major tag version to release commit ([b516013](https://github.com/expo/expo-github-action/commit/b5160133d207c9a70283880b33e34beb157cc7ea))
* skip steps if auth is unavailable ([bb7c723](https://github.com/expo/expo-github-action/commit/bb7c72336b557c49ca0a0e84025e1b4cce23ce2e))
* update github action author name ([#166](https://github.com/expo/expo-github-action/issues/166)) ([520d959](https://github.com/expo/expo-github-action/commit/520d9594e099c7b2475d8b376303466a187bcafa))
### [7.0.3](https://github.com/expo/expo-github-action/compare/7.0.2...7.0.3) (2022-02-14)
+8 -5
View File
@@ -31,6 +31,8 @@ Some additional features are included to make the usage of this action as simple
## Configuration options
> Create your [`EXPO_TOKEN`][link-expo-token] GitHub secret.
This action is customizable through variables defined in the [`action.yml`](action.yml).
Here is a summary of all the input options you can use.
@@ -41,7 +43,7 @@ Here is a summary of all the input options you can use.
| **eas-version** | - | EAS CLI version to install _(skips when omitted)_ |
| **eas-cache** | `true` | If it should use the GitHub actions cache ([read more](#using-the-built-in-cache)) |
| **packager** | `yarn` | Package manager to use _(e.g. `yarn` or `npm`)_ |
| **token** | - | Token of your Expo account _(only use with [secrets][link-actions-secrets])_ |
| **token** | - | Token of your Expo account - [get your token][link-expo-token] _(use with [secrets][link-actions-secrets])_ |
| **patch-watchers** | `true` | If it should patch the `fs.inotify.*` limits on Ubuntu ([read more](#enospc-errors-on-linux)) |
## Example workflows
@@ -56,7 +58,7 @@ You can read more about this in the [GitHub Actions documentation][link-actions]
### Publish on any push to main
This workflow listens to the `push` event on the `main` branch.
It sets up all required components to publish the app, including authentication with a token.
It sets up all required components to publish the app, including authentication with a [token][link-expo-token].
> Always use [secrets][link-actions-secrets] when using tokens.
@@ -97,7 +99,7 @@ This action also allows you to install the EAS CLI.
To do this, add the **eas-version** property, and the action will install it.
We recommend using `latest` for the EAS CLI.
> The **token** is shared for both Expo and EAS CLI.
> The [**token**][link-expo-token] is shared for both Expo and EAS CLI.
```yml
on:
@@ -179,9 +181,9 @@ jobs:
### Automatic Expo login
Some Expo commands, like `expo publish` and `eas build`, require you to be authenticated.
This action exports the **token** to ensure you are authenticated in every workflow step.
This action exports the [**token**][link-expo-token] to ensure you are authenticated in every workflow step.
> Note, this action does not store the token anywhere. Each separate workflow job needs to set up the **token** individually.
> Note, this action does not store the [token][link-expo-token] anywhere. Each separate workflow job needs to set up the [**token**][link-expo-token] individually.
### Using the built-in cache
@@ -212,3 +214,4 @@ You can opt-out from patching the file system by setting **patch-watchers** to `
[link-expo-release-channels]: https://docs.expo.dev/distribution/release-channels/
[link-eas-cli]: https://github.com/expo/eas-cli#readme
[link-preview-comment]: https://github.com/expo/expo-github-action/pull/149#issuecomment-1013184520
[link-expo-token]: https://expo.dev/accounts/%5Baccount%5D/settings/access-tokens
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: Expo GitHub Action
author: Cedric van Putten <[email protected]>
author: Expo
description: Publish, build or manage your Expo app with GitHub Actions
branding:
icon: terminal
+14 -1
View File
@@ -15785,6 +15785,7 @@ async function commentAction(input = commentInput()) {
}
const variables = {
projectLink: (0, expo_1.projectLink)(project, input.channel),
projectDeepLink: (0, expo_1.projectDeepLink)(project, input.channel),
projectName: project.name,
projectOwner: project.owner || '',
projectQR: (0, expo_1.projectQR)(project, input.channel),
@@ -15828,7 +15829,7 @@ function template(template, replacements) {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.projectLink = exports.projectQR = exports.projectInfo = exports.projectOwner = exports.authenticate = void 0;
exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectInfo = exports.projectOwner = exports.authenticate = void 0;
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
const io_1 = __nccwpck_require__(7436);
@@ -15915,6 +15916,18 @@ function projectLink(project, channel) {
return url.toString();
}
exports.projectLink = projectLink;
/**
* Create a deep link to open the project in Expo Go
*/
function projectDeepLink(project, channel) {
(0, assert_1.ok)(project.owner, 'Could not create a deep link for project without owner');
const url = new url_1.URL(`exp://exp.host/@${project.owner}/${project.slug}`);
if (channel) {
url.searchParams.append('release-channel', channel);
}
return url.toString();
}
exports.projectDeepLink = projectDeepLink;
/***/ }),
+18 -6
View File
@@ -66905,7 +66905,7 @@ exports.handleCacheError = handleCacheError;
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.projectLink = exports.projectQR = exports.projectInfo = exports.projectOwner = exports.authenticate = void 0;
exports.projectDeepLink = exports.projectLink = exports.projectQR = exports.projectInfo = exports.projectOwner = exports.authenticate = void 0;
const core_1 = __nccwpck_require__(2186);
const exec_1 = __nccwpck_require__(1514);
const io_1 = __nccwpck_require__(7436);
@@ -66992,6 +66992,18 @@ function projectLink(project, channel) {
return url.toString();
}
exports.projectLink = projectLink;
/**
* Create a deep link to open the project in Expo Go
*/
function projectDeepLink(project, channel) {
(0, assert_1.ok)(project.owner, 'Could not create a deep link for project without owner');
const url = new url_1.URL(`exp://exp.host/@${project.owner}/${project.slug}`);
if (channel) {
url.searchParams.append('release-channel', channel);
}
return url.toString();
}
exports.projectDeepLink = projectDeepLink;
/***/ }),
@@ -67031,15 +67043,15 @@ async function resolvePackage(name, range) {
}
exports.resolvePackage = resolvePackage;
/**
* 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.
* Install a module using a node package manager, inside a temporary directory.
* If that's successful, move the module into the worker's tool cache.
*
* Note, we do assume that the packager is globally available AND has the `add <pkgspec>` command.
*/
async function installPackage(name, version, manager) {
const temp = (0, worker_1.tempPath)(name, version);
const tool = await (0, io_1.which)(manager);
await (0, io_1.mkdirP)(temp);
await (0, exec_1.exec)(tool, ['add', `${name}@${version}`], { cwd: temp });
await (0, exec_1.exec)(manager, ['add', `${name}@${version}`], { cwd: temp });
return (0, worker_1.cacheTool)(temp, name, version);
}
exports.installPackage = installPackage;
+1 -1
View File
@@ -1,7 +1,7 @@
{
"private": true,
"name": "expo-github-action",
"version": "7.0.3",
"version": "7.1.1",
"description": "Expo CLI in your GitHub Actions workflow",
"main": "build/index.js",
"repository": {
+12 -11
View File
@@ -52,16 +52,17 @@ There are a few variables available to generate the comment content.
Some of these variables are also exported as subaction output.
Here is a summary of these variables.
| output name | template name | description |
| ---------------- | ---------------- | ---------------------------------------------------- |
| **projectOwner** | `{projectOwner}` | The resolved owner of the project |
| **projectSlug** | `{projectSlug}` | The resolved slug of the project |
| **projectName** | `{projectName}` | The resolved name of the project |
| **projectLink** | `{projectLink}` | The expo.dev project link, including release channel |
| **projectQR** | `{projectQR}` | The QR code link, to load the project in Expo Go |
| - | `{channel}` | The release channel that was used |
| **message** | - | The resolved message content |
| **messageId** | - | The resolved message id content |
| output name | template name | description |
| ---------------- | ---------------- | ----------------------------------------------------- |
| **projectOwner** | `{projectOwner}` | The resolved owner of the project |
| **projectSlug** | `{projectSlug}` | The resolved slug of the project |
| **projectName** | `{projectName}` | The resolved name of the project |
| **projectDeepLink** | `{projectDeepLink}` | A deep link to open the project in Expo Go |
| **projectLink** | `{projectLink}` | The expo.dev project link, including release channel |
| **projectQR** | `{projectQR}` | The QR code link, to load the project in Expo Go |
| - | `{channel}` | The release channel that was used |
| **message** | - | The resolved message content |
| **messageId** | - | The resolved message id content |
## Example workflows
@@ -97,7 +98,7 @@ jobs:
- name: 🏗 Setup Expo
uses: expo/expo-github-action@v7
with:
expo-version: 5.x
expo-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: 📦 Install dependencies
+1 -1
View File
@@ -1,6 +1,6 @@
---
name: Expo GitHub Action - Preview comment
author: Cedric van Putten <[email protected]>
author: Expo
description: Add Expo preview comments to pull requests
branding:
icon: message-circle
+2 -1
View File
@@ -1,6 +1,6 @@
import { getBooleanInput, getInput, setOutput, info } from '@actions/core';
import { projectInfo, projectLink, projectOwner, projectQR } from '../expo';
import { projectDeepLink, projectInfo, projectLink, projectOwner, projectQR } from '../expo';
import { createIssueComment, pullContext } from '../github';
import { executeAction } from '../worker';
@@ -34,6 +34,7 @@ export async function commentAction(input: CommentInput = commentInput()) {
const variables: Record<string, string> = {
projectLink: projectLink(project, input.channel),
projectDeepLink: projectDeepLink(project, input.channel),
projectName: project.name,
projectOwner: project.owner || '',
projectQR: projectQR(project, input.channel),
+14
View File
@@ -98,3 +98,17 @@ export function projectLink(project: ProjectInfo, channel?: string): string {
return url.toString();
}
/**
* Create a deep link to open the project in Expo Go
*/
export function projectDeepLink(project: ProjectInfo, channel?: string): string {
assert(project.owner, 'Could not create a deep link for project without owner');
const url = new URL(`exp://exp.host/@${project.owner}/${project.slug}`);
if (channel) {
url.searchParams.append('release-channel', channel);
}
return url.toString();
}
+6 -6
View File
@@ -1,5 +1,5 @@
import { exec, getExecOutput } from '@actions/exec';
import { which, mkdirP } from '@actions/io';
import { mkdirP } from '@actions/io';
import { cacheTool, tempPath } from './worker';
@@ -31,16 +31,16 @@ export async function resolvePackage(name: string, range: string): Promise<strin
}
/**
* 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.
* Install a module using a node package manager, inside a temporary directory.
* If that's successful, move the module into the worker's tool cache.
*
* Note, we do assume that the packager is globally available AND has the `add <pkgspec>` command.
*/
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 });
await exec(manager, ['add', `${name}@${version}`], { cwd: temp });
return cacheTool(temp, name, version);
}
+19 -1
View File
@@ -2,7 +2,7 @@ import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as io from '@actions/io';
import { authenticate, projectQR, projectLink } from '../src/expo';
import { authenticate, projectQR, projectLink, projectDeepLink } from '../src/expo';
jest.mock('@actions/core');
jest.mock('@actions/exec');
@@ -68,3 +68,21 @@ describe(projectLink, () => {
);
});
});
describe(projectDeepLink, () => {
it('throws when owner is undefined', () => {
expect(() => projectDeepLink({ name: 'fakename', slug: 'fakeslug' })).toThrow('without owner');
});
it('returns url with owner and slug', () => {
expect(projectDeepLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' })).toBe(
'exp://exp.host/@fakeowner/fakeslug'
);
});
it('returns url with owner, slug, and release channel', () => {
expect(projectDeepLink({ name: 'fakename', slug: 'fakeslug', owner: 'fakeowner' }, 'fakechannel')).toBe(
'exp://exp.host/@fakeowner/fakeslug?release-channel=fakechannel'
);
});
});