Release to alpha by @eunbae0 #8
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: 'Release Codepush' | |
run-name: Release to ${{ inputs.environment }} by @${{ github.actor }} | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: '배포 대상 환경' | |
required: true | |
default: 'alpha' | |
type: choice | |
options: | |
- alpha | |
- prod | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
APP_CENTER_TOKEN: ${{ secrets.APP_CENTER_TOKEN }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node 18.16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.16.x' | |
cache: 'yarn' | |
env: | |
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | |
- name: Set Yarn Version | |
id: set-version | |
run: | | |
yarn set version 3.6.4 | |
echo "YARN_VERSION=$(yarn -v)" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | |
- name: Get cache dir path | |
id: yarn-cache-dir-path | |
run: echo "CACHE_DIR=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Yarn cache | |
uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.CACHE_DIR }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ steps.set-version.outputs.YARN_VERSION }} | |
restore-keys: | | |
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}- | |
- name: Install dependencies | |
run: | | |
CACHE_HIT="${{ steps.yarn-cache.outputs.cache-hit }}" | |
NODE_MODULES_EXISTS=$(test -d "node_modules" && echo "true" || echo "false") | |
if [[ "$CACHE_HIT" != 'true' || "$NODE_MODULES_EXISTS" == 'false' ]]; then | |
yarn install | |
fi | |
- name: Install Appcenter CLI | |
run: npm install -g appcenter-cli | |
- name: Login to Appcenter | |
run: appcenter login --token ${{ env.APP_CENTER_TOKEN }} | |
env: | |
APP_CENTER_TOKEN: ${{ env.APP_CENTER_TOKEN }} | |
- name: Deploy to Codepush | |
run: yarn codepush:ios && yarn codepush:android | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: Release to ${{ inputs.environment }} | |
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | |
signoff: false | |
title: 'Release to ${{ inputs.environment }}' | |
body: | | |
# Release to ${{ inputs.environment }} | |
- Auto-generated by [create-pull-request][1] | |
assignees: ${{ github.actor }} | |
branch: develop | |
# - name: Merge publish to main | |
# run: | | |
# git config user.name "${{ github.actor }}" | |
# git config user.email "${{ github.actor }}@users.noreply.github.com" | |
# git checkout main | |
# git merge --no-ff --no-edit develop | |
# git push origin main |