Skip to content

Commit

Permalink
Merge pull request #35 from tarappo/release_workflow
Browse files Browse the repository at this point in the history
リリース用のワークフローの作成+α
  • Loading branch information
tarappo authored Jul 23, 2024
2 parents a01b46d + c37f9cc commit cb0d0c1
Show file tree
Hide file tree
Showing 21 changed files with 151 additions and 410 deletions.
10 changes: 10 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,13 @@ workflows:
jobs:
- build
- test
cron_workflow:
triggers:
- schedule:
cron: "0 15 10 * *"
filters:
branches:
only:
- main
jobs:
- build
31 changes: 31 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Documentation:
- changed-files:
- any-glob-to-any-file:
- docs/*
- README.md

"GitHub Actions Workflow":
- changed-files:
- any-glob-to-any-file:
- .github/workflows/*

"Bitrise Workflow":
- changed-files:
- any-glob-to-any-file:
- bitrise.yml

"CircleCI Workflow":
- changed-files:
- any-glob-to-any-file:
- .circleci/config.yml

iOS:
- changed-files:
- any-glob-to-any-file:
- ci-sample/*
- ci-sample.xcodeproj/*

Fastlane:
- changed-files:
- any-glob-to-any-file:
- fastlane/*
31 changes: 31 additions & 0 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Cron

on:
schedule:
- cron: '0 15 10 * *'

permissions: write-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: macos-latest
timeout-minutes: 40
env:
DEVELOPER_DIR: "/Applications/Xcode_15.4.app/Contents/Developer"
steps:
- uses: actions/checkout@v4
- name: archive
run: |
xcodebuild archive CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -project ./ci-sample.xcodeproj -scheme ci-sample -configuration Debug -archivePath ./ci-sample_debug
- name: upload testflight
env:
AUTHKEY_P8_BASE64: ${{ secrets.AUTHKEY_P8_BASE64 }}
ISSUER_ID: ${{ secrets.ISSUER_ID }}
KEY_ID: ${{ secrets.KEY_ID }}
run: |
echo $AUTHKEY_P8_BASE64 | base64 -d > $PWD/Authkey.p8
xcodebuild -exportArchive -archivePath ci-sample_debug.xcarchive -exportPath ./build_result -exportOptionsPlist ./ExportOptionsTestFlight.plist -allowProvisioningUpdates -authenticationKeyIssuerID $ISSUER_ID -authenticationKeyID $KEY_ID -authenticationKeyPath $PWD/Authkey.p8
22 changes: 22 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Pull Request Labeler"

on:
pull_request:
branches:
- main
workflow_dispatch:

permissions: write-all

jobs:
labeler:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/labeler@v5
with:
sync-labels: true
dot: true
58 changes: 22 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,34 @@ name: iOS Release

on:
push:
branches:
- main
tags:
- 'v*'

jobs:
build:
runs-on: macos-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- name: Cache bundle directory
uses: actions/cache@v4
with:
path: vendor/bundle
key: ${{ runner.os }}-gem-${{ hashFiles('Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gem-
- name: Setup
shell: bash
id: setup
run: |
bundle config set path 'vendor/bundle'
bundle install
- name: Build iOS App
shell: bash
id: build-app-file
- name: archive
run: |
bundle exec fastlane build_for_simulator
cd build/Build/Products/Debug-iphonesimulator/
zip -r ci-sample.zip ci-sample.app/
- name: Release note
id: release_note
uses: release-drafter/release-drafter@v5
xcodebuild archive CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO -project ./ci-sample.xcodeproj -scheme ci-sample -configuration Debug -archivePath ./ci-sample_debug
- name: ipa
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
publish: true
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
AUTHKEY_P8_BASE64: ${{ secrets.AUTHKEY_P8_BASE64 }}
ISSUER_ID: ${{ secrets.ISSUER_ID }}
KEY_ID: ${{ secrets.KEY_ID }}
run: |
echo $AUTHKEY_P8_BASE64 | base64 -d > $PWD/Authkey.p8
xcodebuild -exportArchive -archivePath ci-sample_debug.xcarchive -exportPath ./build_result -exportOptionsPlist ./ExportOptions.plist -allowProvisioningUpdates -authenticationKeyIssuerID $ISSUER_ID -authenticationKeyID $KEY_ID -authenticationKeyPath $PWD/Authkey.p8
zip -r ci-sample.zip ./build_result/ci-sample.ipa
- name: Create Release
id: create_release
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
upload_url: ${{ steps.release_note.outputs.upload_url }}
asset_path: build/Build/Products/Debug-iphonesimulator/ci-sample.zip
asset_name: ci-sample.zip
asset_content_type: application/zip
tag_name: ${{ github.ref_name }}
name: "CI Sample Release ${{ github.ref_name }}"
generate_release_notes: true
prerelease: false
fail_on_unmatched_files: true
files: ci-sample.zip
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# CI/CDサービスで利用する用のアプリ(iOS版)
CI/CDサービスで試してみるためのiOS版のアプリです。
iOSアプリのコードだけでなく、CI/CDサービスに関する情報も併せて管理します。

- [ドキュメント](docs/README.md)

# ブランチ管理
* main
Expand All @@ -22,6 +19,8 @@ mainは常に問題ないコードが入っている前提です。

- 特定タイミングになったらtagをきってリリース

通常はApp Store Connectにアップロードし申請中にしますが、審査が通るアプリではないため審査に投げることはしていません。


# CI/CDサービスごとの実行内容
すべてのCI/CDサービスでTest Flightへのアップロードをおこなうのは微妙なので次のように分けています。
Expand All @@ -31,6 +30,9 @@ mainは常に問題ないコードが入っている前提です。
|GitHub Actions|PR|TestFlightへアップロード|
|CircleCI|PR|アプリのビルドと保存|
|Bitrise|PR|アプリのビルドと保存|
|GitHub Actions|Tag|リリースノート作成|
|GitHub Actions|月1回定期実行|TestFlightへアップロード|
|CircleCI|月1回定期実行|アプリのビルドと保存|



Expand Down
32 changes: 27 additions & 5 deletions ci-sample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,26 +1,48 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22684"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="ci_sample" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="ハロー世界" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="A6g-fo-wXM">
<rect key="frame" x="156" y="233" width="80" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="No" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eWw-A1-e6U">
<rect key="frame" x="156" y="280" width="80" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
<connections>
<outlet property="buildNumberLabel" destination="eWw-A1-e6U" id="noz-Yv-Ktm"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="139.69465648854961" y="4.9295774647887329"/>
</scene>
</scenes>
</document>
4 changes: 3 additions & 1 deletion ci-sample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
import UIKit

class ViewController: UIViewController {

@IBOutlet weak var buildNumberLabel: UILabel!

override func viewDidLoad() {
super.viewDidLoad()
self.buildNumberLabel.text = Bundle.main.infoDictionary!["CFBundleVersion"] as? String
}

override func didReceiveMemoryWarning() {
Expand Down
102 changes: 0 additions & 102 deletions docs/README.md

This file was deleted.

Loading

0 comments on commit cb0d0c1

Please sign in to comment.