시나리오 : Testflight에 바이너리가 업로드 된 시점에 슬랙 채널로 알림이 오도록 해보자
공식문서를 보고싶다면 바로 아래 링크로 들어가서 보면 된다.
https://docs.fastlane.tools/actions/slack/
slack - fastlane docs
Create an Incoming WebHook and export this as SLACK_URL. Can send a message to #channel (by default), a direct message to @username or a message to a private group group with success (green) or failure (red) status. It is recommended to add the above actio
docs.fastlane.tools
1. 알림을 보낼 슬랙 채널의 webhookURL이 필요하다.
Slack용 수신 웹후크
수신 웹후크는 외부 소스에서 워크스페이스로 정보를 공유할 수 있는 간단한 방식입니다. 이용 방법 선택한 채널로 데이터를 보냅니다. 채널의 BAD+2CB...
slack.com
Incoming WebHooks를 추가해주자.
알림을 보낼 채널을 선택하고 "Add Incoming WebHooks integration"을 클릭 하면
TADA! 이렇게 webhookURL을 얻을 수 있다!
2. 이번에 테스트 해볼 때는 fastlane에서 Beta로 있는 Fastlane.swift를 통해 진행해 보았다.
(ruby가 아닌 swift 언어로 구성할 수 있어서 더 용이하게 사용해 볼 수 있을 거 같음)
https://docs.fastlane.tools/getting-started/ios/fastlane-swift/
Swift - fastlane docs
Getting Started with Fastlane.swift (beta) Welcome to Fastlane.swift. Fastlane.swift allows you to write your fastlane configuration using Xcode, in Swift - the language you have come to know and love from the world of iOS development. Fastlane.swift is cu
docs.fastlane.tools
fastlane init swift
이렇게 Swift용 파일이 만들어진다 오우 ㅋㅋ
class Fastfile: LaneFile {
//생성한 webhookURL
var webhookURL = "https://hooks.slack.com/services/....."
func sendSlackNotification() {
.....
slack(message: "App successfully released!",
channel: "#general",
slackUrl: webhookURL,
username: "atlas",
payload: ["version": "\(getVersionNumber( target: "#schema}"))(\(getBuildNumber()))"] )
//추가적으로 버전 정보를 넘겨주도록 payload 설정
}
상황이나 필요에 따라서 지원하는 파라미터를 확인해서 사용해보면 좋을 것 같다.
이렇게 만든 lane을 실행해보면
fastlane sendSlackNotification
세상에나 마상에나 ㅋㅋ 그저 행복할 따름이다 ㅋㅋㅋ
[삽질이야기] fastlane 새로운 기기 등록하기 (Register new devices) (0) | 2022.11.01 |
---|---|
[review] fastlane을 사용후기 (0) | 2022.10.05 |
[fastlane] match로 배포해보기 (2) | 2022.09.16 |
[fastlane] 프로젝트 설정 (0) | 2022.09.16 |
[fastlane] 설치 (0) | 2022.09.16 |
댓글 영역