Publish #251
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
platform: | |
description: "Select the platform to build and publish" | |
required: true | |
default: "all" | |
type: choice | |
options: | |
- all | |
- macos | |
- macos-arm64 | |
- windows | |
- linux | |
jobs: | |
build-expo: | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name == 'push' || github.event.inputs.platform == 'all' || github.event.inputs.platform == 'macos' || github.event.inputs.platform == 'macos-arm64' || github.event.inputs.platform == 'windows' || github.event.inputs.platform == 'linux' }} | |
steps: | |
- name: Check out Expo repository | |
run: | | |
git clone https://github.com/wcpos/managed-expo.git expo | |
touch expo/yarn.lock | |
- name: Install Node.js, NPM and Yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install jq | |
run: sudo apt-get install -y jq | |
- name: Add RXDB_LICENSE_KEY to package.json | |
env: | |
RXDB_LICENSE_KEY: ${{ secrets.RXDB_LICENSE_KEY }} | |
run: | | |
cd expo | |
jq --arg license "$RXDB_LICENSE_KEY" '.accessTokens["rxdb-premium"] = $license' package.json > tmp.json && mv tmp.json package.json | |
- name: Install Expo dependencies | |
env: | |
YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
run: | | |
cd expo | |
yarn install | |
- name: Run Expo export and fix bundle | |
run: | | |
cd expo | |
yarn export:electron | |
# Fix bundle path | |
sed -i 's/src="\/_expo/src="_expo/g' dist/index.html | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: expo-dist | |
path: expo/dist | |
publish-macos: | |
needs: build-expo | |
runs-on: macos-13 | |
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'macos' }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Download expo-dist artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: expo-dist | |
path: dist | |
- name: Install Node.js, NPM, and Yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Python and distutils | |
run: | | |
python3 -m ensurepip | |
python3 -m pip install setuptools | |
- name: Signing By Apple Developer ID | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
p12-file-base64: ${{ secrets.MAC_CERTS }} | |
p12-password: ${{ secrets.MAC_CERTS_PASSWORD }} | |
- name: Install and build | |
env: | |
YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
run: | | |
yarn install | |
yarn rebuild:all | |
- name: Publish MacOS x64 release | |
env: | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASS }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
yarn publish-app | |
publish-macos-arm64: | |
needs: | |
- build-expo | |
# - publish-macos | |
runs-on: macos-latest | |
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'macos-arm64' }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Download expo-dist artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: expo-dist | |
path: dist | |
- name: Install Node.js, NPM, and Yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Signing By Apple Developer ID | |
uses: apple-actions/import-codesign-certs@v2 | |
with: | |
p12-file-base64: ${{ secrets.MAC_CERTS }} | |
p12-password: ${{ secrets.MAC_CERTS_PASSWORD }} | |
- name: Install and build | |
env: | |
YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
run: | | |
yarn install | |
yarn rebuild:all | |
- name: Publish MacOS arm64 release | |
env: | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASS }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ARCH: arm64 | |
run: | | |
yarn publish-app --arch=arm64 --platform=darwin | |
publish-windows: | |
needs: build-expo | |
runs-on: windows-latest | |
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'windows' }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Download expo-dist artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: expo-dist | |
path: dist | |
- name: Install Node.js, NPM, and Yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install and build | |
env: | |
YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
run: | | |
yarn install | |
yarn rebuild:all | |
- name: Publish Windows release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
yarn publish-app | |
publish-linux: | |
needs: build-expo | |
runs-on: ubuntu-latest | |
if: ${{ github.event.inputs.platform == 'all' || github.event.inputs.platform == 'linux' }} | |
steps: | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Download expo-dist artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: expo-dist | |
path: dist | |
- name: Install Node.js, NPM, and Yarn | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install and build | |
env: | |
YARN_ENABLE_IMMUTABLE_INSTALLS: false | |
run: | | |
yarn install | |
yarn rebuild:all | |
- name: Publish Linux release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
yarn publish-app |