Skip to content

[CD-Deploy] refs/heads/main #3

[CD-Deploy] refs/heads/main

[CD-Deploy] refs/heads/main #3

Workflow file for this run

name: CD-Deploy
run-name: "[CD-Deploy] ${{ github.event.pull_request.title || github.ref }}"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
VERSION_NUMBER:
description: 'Version Number of the app (e.g., 1.0.0). Auto-detect from the Xcode project if left blank.'
required: false
type: string
BUILD_NUMBER:
description: 'Build number of the app (e.g., 1). Will use a timestamp if left blank.'
required: false
type: string
RELEASE_NOTE:
description: 'Release notes of the deployment.'
required: false
type: string
jobs:
Deploy:
runs-on: macos-15
timeout-minutes: 80
# use zsh
defaults:
run:
shell: zsh {0}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: true
- name: Read .xcode-version
id: read_xcode_version
run: |
XCODE_VERSION=$(cat .xcode-version)
echo "XCODE_VERSION: ${XCODE_VERSION}"
echo "xcode_version=${XCODE_VERSION}" >> $GITHUB_OUTPUT
- name: Read .ruby-version
id: read_ruby_version
run: |
RUBY_VERSION=$(cat .ruby-version)
echo "RUBY_VERSION: ${RUBY_VERSION}"
echo "ruby_version=${RUBY_VERSION}" >> $GITHUB_OUTPUT
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "${{ steps.read_ruby_version.outputs.ruby_version }}"
# Bundle cache
- name: Cache Bundle
uses: actions/cache@v3
with:
path: |
./vendor
key: ${{ runner.os }}-bundle-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-bundle-
# CocoaPods cache
- name: Cache CocoaPods
uses: actions/cache@v3
with:
path: |
./Product/Pods
key: ${{ runner.os }}-cocoapods-${{ hashFiles('Product/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-cocoapods-
# Mint cache
- name: Cache Mint
uses: actions/cache@v3
with:
path: ./mint
key: ${{ runner.os }}-mint-${{ hashFiles('Mintfile') }}
restore-keys: |
${{ runner.os }}-mint-
- name: Install Dependency
run: |
make setup
make install
- name: beta
working-directory: ./Product/
env:
VERSION_NUMBER: ${{ inputs.VERSION_NUMBER || '' }}
BUILD_NUMBER: ${{ inputs.BUILD_NUMBER || '' }}
RELEASE_NOTE: ${{ inputs.RELEASE_NOTE || '' }}
AUTHOR: ${{ github.actor }}
#
FIREBASE_CLI_TOKEN: ${{ secrets.FIREBASE_CLI_TOKEN }}
DEVELOPER_DIR: "/Applications/Xcode_${{ steps.read_xcode_version.outputs.xcode_version }}.app/Contents/Developer"
run: |
BUILD_TIMESTAMP=$(date +'%Y%m%d%H%M%S')
# 如果 BUILD_NUMBER 沒有值,用 BUILD_TIMESTAMP
BUILD_NUMBER="${BUILD_NUMBER:-$BUILD_TIMESTAMP}"
ID="${{ github.run_id }}"
COMMIT_SHA="${{ github.sha }}"
BRANCH_NAME="${{ github.ref_name }}"
AUTHOR="${{ env.AUTHOR }}"
RELEASE_NOTE="${{ env.RELEASE_NOTE }}
ID: ${ID}
Commit SHA: ${COMMIT_SHA}
Branch: ${BRANCH_NAME}
Author: ${AUTHOR}
"
bundle exec fastlane beta release_notes:"${RELEASE_NOTE}" version_number:"${VERSION_NUMBER}" build_number:"${BUILD_NUMBER}"