ããã«ã¡ã¯ï¼2017å¹´11æã«Androidã¨ã³ã¸ãã¢ã¨ãã¦Joinããé¢æ ¹ã§ãã æè¿ã髪ã®æ¯ãé髪ã«ãã¾ãããè¿ã Android Studioã¸ã®æ¬æãè©ãã¦ç·è²ã«æãç´ããããªã¼ã¨èãã¦ããã¾ãã
ä»åã¯ãã³ãããã®Androidãã¼ã ã§GitHub Actionsãå©ç¨ãã¦å®è·µãã¦ããäºä¾ãç´¹ä»ãããã¨æãã¾ãã
ãã®è¨äºã¯ã³ããã Advent Calendar 2019 7æ¥ç®ã®è¨äºã§ãã
GitHub Actionsã¨ã¯
æ¬é¡ã«å ¥ãåã«ãç°¡åã«GitHub Actionsã«ã¤ãã¦ç´¹ä»ãã¾ãã
GitHub Actionsã¯2019å¹´11æã«æ£å¼çã¨ãªã£ãGitHubã®æ©è½ã®ä¸ã¤ã§ãã ç¹å®ã®ã¤ãã³ããããªã¬ã¼ã«ãã¦ãèªåã§ä¸è¦§ã®ããã»ã¹ãå®è¡ãã¦ããã¾ãã ä¾ãã°ãGitHubã«ãã©ã³ããä½ãããéã«ãã«ãªã¯ã¨ã¹ããèªåã§ä½æããã¨ãããããªããã»ã¹ãå®ç¾ã§ãã¾ããGitHubã§ã¯ä¸é£ã®ããã»ã¹ãã¯ã¼ã¯ããã¼ã¨å¼ã³ãåã ã®ã¿ã¹ã¯ã®ãã¨ãã¢ã¯ã·ã§ã³ã¨å¼ãã§ãã¾ãã ããããã解説ããã¨ä»¥ä¸ã®éãã§ãã
ã¯ã¼ã¯ããã¼
ã©ã®Githubã¤ãã³ãçºçæã«ä½ãå®è¡ãããã®ããã»ã¹ãå®ç¾©ããããã®ã§ãGitHub Actionsã®èµ·ç¹ã¨ãªãæ¦å¿µã§ããããã«ããããã¹ããããã ã±ã¼ã·ãããªãªã¼ã¹ãªã©ã®ç¨éã«ãªãã¸ããªæ¯ã«ã»ããã¢ãããå¯è½ã§ãYAMLã§è¨è¿°ãè¡ãã¾ããä¾ãã°ãPushæã«ç¹å®ã®ããã»ã¹ãå®è¡ããå ´åã«ã¯ä¸è¨ã®ãããªè¨è¿°ããã¾ãã
ã¸ã§ãã¨å¼ã°ããã¹ããããè¨å®ãããã¨ãå¯è½ã§ããã®ã¸ã§ãã®ä¸ã§ã¢ã¯ã·ã§ã³ãå®è¡ãã¦ããã¾ãã
ã¢ã¯ã·ã§ã³
ã¯ã¼ã¯ããã¼å ã§å®è¡ãããåã ã®ã¿ã¹ã¯ã®ãã¨ã§ãGitHub Actionsã®æå°æ§æè¦ç´ ã§ä¸æ ¸çãªæ¦å¿µã®ä¸ã¤ã§ãã
ã¢ã¯ã·ã§ã³ã«ã¯ç¾æç¹ã§JavaScriptã¨Docker ã³ã³ããã®ï¼ç¨®é¡ã®ä½ææ¹æ³ãç¨æããã¦ãããã¯ã¼ã¯ããã¼å ã§ä¸è¨ã®3ã¤ã®æ¹æ³ã§ã¢ã¯ã·ã§ã³ãåç §ããå©ç¨ãå¯è½ã§ãã
- åããªããã·ãããªã¦ãå®ç¾©ããã¦ããã¢ã¯ã·ã§ã³
- GitHubã®OSSã®ã¢ã¯ã·ã§ã³
- å ¬éããã¦ããDockerã³ã³ããã¤ã¡ã¼ã·ã
ãã®ããã«ã¯ã¼ã¯ããã¼ãä½æããã¹ããããã¨ã«ã¢ã¯ã·ã§ã³ãå¼ã³åºããããã¨ã§ãä¸é£ã®ããã»ã¹ãå®è¡ããã¦ããã¾ãã ã³ãããã§ã¯Androidã¢ããªã®ã¬ãã¸ããªå ã«ã¯ã¼ã¯ããã¼ã¨ã¢ã¯ã·ã§ã³ãç¨æããå©ç¨ãã¦ãã¾ãã ãã詳ããå©ç¨æ¹æ³ã¯å ¬å¼ããã¥ã¡ã³ããèªãã§ã¿ã¦ãã ããã
ãªãªã¼ã¹ä½æ¥ã¨ãã®æé
ãã¦ãã¿ã¤ãã«ã«ãæ¸ããã¦é ããéããAndroidãã¼ã ã§ã¯ç¾å¨ãªãªã¼ã¹ä½æ¥ã§GitHub Actionsãå©ç¨ãã¦ãã¾ããã³ãããã§ã®Androidã¢ããªã®ãªãªã¼ã¹ä½æ¥ã¯ä¸è¨ã®éãã§ãã
- developãã©ã³ãããreleaseãã©ã³ããä½æãã
- releaseãã©ã³ãããmasterãã©ã³ãã¸Pull Requestãä½æãã
- releaseãã©ã³ãã§ãã¹ããè¡ãã社å ã¸ã®ãã¼ã¿é å¸ãè¡ã
- ã¹ãã¢ã¸ã®æ®µéãªãªã¼ã¹ã¸ãéå§ãã
- releaseãã©ã³ããmasterãã©ã³ãã«mergeãã
- GitHubã«ãªãªã¼ã¹ãã¼ããä½æãã
å±¥æ´ã®å¯è¦åãé害çºçæã®åãæ»ãã®ããã«ä¸è¨ã®ãããªæé ãè¸ãã§ããã¾ããããããã®æé ã¯å°å³ãªããé±ã«ä¸åº¦ã®ãªãªã¼ã¹ã§ã¯ä¸ã ã«æéã®ãããä½æ¥ã§ãããã¾ããããããã£ãä½æ¥ã¯èªååããæ¹ãå¹ççã«æ¥åãé²ããããã®ã§ãGitHub Actionsãå©ç¨ãã¦èªååã«è¨ã¿ã¾ããã
ããã¦èªååã¸
GitHubã®æä½ãä¼´ããã®ãèªååãè¡ãç®æã¨ãã¦é¸æããç¾å¨ã¯ä¸è¨ã®3ã¤ã®ã¢ã¯ã·ã§ã³ãå©ç¨ãã¦ãã¾ãã
- ãªãªã¼ã¹ãã«ãªã¯ã¨ã¹ãã®èªåä½æã®ã¢ã¯ã·ã§ã³
- ãªãªã¼ã¹ãã¼ãã®èªåä½æã®ã¢ã¯ã·ã§ã³
- Slackéç¥ç¨ã®OSSã®ã¢ã¯ã·ã§ã³
ãã®3ã¤ã®ã¢ã¯ã·ã§ã³ã§ãå è¿°ãããªãªã¼ã¹ããã¼ã®2ã5ã6ã®ã¹ããããèªååãã¦ãã¾ãã
ãªãªã¼ã¹ãã«ãªã¯ã¨ã¹ãã®èªåä½æ
ã¾ãã¯ãªãªã¼ã¹ãã«ãªã¯ã¨ã¹ãã®èªåä½æããç´¹ä»ãããã¾ãã ã³ãããã§ã¯ãªãªã¼ã¹ãã©ã³ããä½ãéã«ãå±¥æ´ã®å¯è¦åã®ããã«ããã®ãã¼ã¸ã§ã³ã«è¿½å ãããæ©è½ããã°ä¿®æ£ã®ãªã¹ããããã«ãªã¯ã¨ã¹ãã®æ¬æã«æ®ãããã«ãã¦ããã¾ãããã®ä½æ¥ãèªååããããã«ã以ä¸ã®ã¢ããã¼ããã¨ãã¾ããã
- releaseãã©ã³ããä½ããããã¨ãããªã¬ã¼ã¨ããã¯ã¼ã¯ããã¼ã®ä½æ
- ååãªãªã¼ã¹ããã®å·®åãå ã«ãããã«ãªã¯ã¨ã¹ããä½æããã¢ã¯ã·ã§ã³
ã¯ã¼ã¯ããã¼ã¨ã¢ã¯ã·ã§ã³ã¯ãããã以ä¸ã®ãããªå®è£ ã§ãã
ã¯ã¼ã¯ããã¼
â ã®è¨å®ã§GitHubã«Pushãããã©ã³ããåºæ¥ä¸ãããã¨ã§ã¯ã¼ã¯ããã¼ãå®è¡ããã¾ãã ä»åã¯ãªãªã¼ã¹ãã©ã³ãã®ã¿ã§ã¢ã¯ã·ã§ã³ãå®è¡ãããã®ã§ãâ¡ã§ifæ§æãå©ç¨ãã¦ãã©ã³ãåã®ãã¬ãã£ãã¯ã¹ã§ãã£ã«ã¿ã¼ãããã¦ãã¾ãã â ã¨â¡ã®ä¸¡æ¹ã®æ¡ä»¶ãã¿ããããã¨ãæå®ã®ã¢ã¯ã·ã§ã³ãå®è¡ããããã«ãªã¯ã¨ã¹ããä½æãã¦ãã¾ãã
ã¢ã¯ã·ã§ã³
ãã«ãªã¯ã¨ã¹ãã®ä½æã¯ãDocker ã³ã³ããã®ã¢ã¯ã·ã§ã³ã§ãä¸è¨ã®ãããªã¹ã¯ãªãããå®è¡ãã¦ãã¾ãã
â ã§ååã®ãªãªã¼ã¹ã¿ã°ã¨ã®å·®åããªã¹ãã¢ãããã¦ããã«ãªã¯ã¨ã¹ãã®æ¬æãä½æãã¦ãã¾ããç¾æ®µéã§ã¯Draftã®ç¶æ ã§ãã«ãªã¯ã¨ã¹ããä½ããæåã§èªã¿ãããä½è£ãæ´ããä¸ã§Ready For Reviewã¨ããããã«ãã¦ãã¾ãã
ãããã®å®è¡å¾ã«ã¯ä¸è¨ã®ãããªãã«ãªã¯ã¨ã¹ããä½æããã¾ãã
ããã§æé ãreleaseãã©ã³ããpushããã ãã§ããã«ãªã¯ã¨ã¹ãã®ä½æã¾ã§ãåèªåçã«è¡ãããããã«ãªãã¾ããã
ãªãªã¼ã¹ãã¼ãã®èªåä½æ
ç¶ãã¦ãªãªã¼ã¹ãã¼ãã®ä½æã§ãããã¡ãã¯ã¹ãã¢å ¬éå¾ã«å±¥æ´ãæ®ãããã«å®æ½ãã¦ããã¾ãã ãªãªã¼ã¹ãã¼ããæåã§ä½æããã¨ãã¿ã°ã®è¨å®ãã¿ã¤ãã«ã¨æ¬æã®æè¨ãªã©ã®ç´°ããªä½æ¥ã«å ãã¦ãtypoã®æç¡ãã¿ã°ãä½æãããã©ã³ãã®åãå ãæ£ããããªã©ãç®è¦ç¢ºèªããããã¨ãå¤ããé¢åãªä½æ¥ã¨ãªã£ã¦ãã¾ããã
ãããã解決ããããã«Github Actionsã§ä»¥ä¸ã®ã¢ããã¼ããè¡ãã¾ããã
- masterãã©ã³ãã¸ã®ãã«ãªã¯ã¨ã¹ãããã¼ã¸ããããã¨ãããªã¬ã¼ã«ããã¯ã¼ã¯ããã¼ã®ä½æ
- ãã«ãªã¯ã¨ã¹ãã®å 容ãå ã«GitHub Releaseãä½æããã¢ã¯ã·ã§ã³
ã¯ã¼ã¯ããã¼ã¨ã¢ã¯ã·ã§ã³ã¯ãããã以ä¸ã®ãããªå®è£ ã§ãã
ã¯ã¼ã¯ããã¼
masterãã©ã³ãã¸ã®ãã«ãªã¯ã¨ã¹ãããã¼ã¸ããããã¨ãéæããããã«â ãâ¡ãâ¢ã¨ã®ç®æã§ããããããªã¬ã¼ã®è¨å®ã¨ãã£ã«ã¿ã¼è¨å®ããã¦ãã¾ããè¨è¿°ç®æãé¢ãã¦ãã¾ã£ã¦ããã®ãããã¾ã«å·ã§ããã»ã»ã»ããããããã·ã³ãã«ãªè¨è¿°æ¹æ³ãããã°æãã¦ãã ããï¼
ã¢ã¯ã·ã§ã³
â ã§å ã®ãã«ãªã¯ã¨ã¹ãã®æ¬æãåå¾ãããªãªã¼ã¹ãã¼ãã«å©ç¨ãã¦ãã¾ãããã®ããã«ã¯ã¼ã¯ããã¼ã®èµ·ç¹ã¨ãªã£ãGitHubã¤ãã³ãã®ãã¤ãã¼ãã$GITHUB_EVENT_PATHã«jsonãã¡ã¤ã«ã§ä¿åããã¦ããã®ã§ãå¿ è¦ãªæ å ±ãèªã¿åºããã¢ã¯ã·ã§ã³å ã§å©ç¨ãããã¨ãå¯è½ã¨ãªã£ã¦ãã¾ãã
ããããå®è¡ãããã¨ä¸è¨ã®ãããªãªãªã¼ã¹ãã¼ããä½æããã¾ãã
OSSãå©ç¨ããã¢ã¯ã·ã§ã³
ã¾ãã³ãããã§ã¯ã社å ã¸ã®ãã¼ã¿é å¸ã®åã«PlayStoreã®ãã®ãªãªã¼ã¹ã®æ°æ©è½ã«æ²è¼ããæç« ããã£ã¬ã¯ã¿ã¼ã«èãã¦ããã£ã¦ãã¾ãããã«ãªã¯ã¨ã¹ãã®å 容ãå ã«æç« ãèããã®ã§ãããGitHub Actionsã®å°å ¥åã¾ã§ã¯æåã§å ±æãè¡ãªã£ã¦ãã¾ãããç¾å¨ã¯OSSã®ã¢ã¯ã·ã§ã³ãå©ç¨ãã¦Slackã¸ã®éç¥ãè¡ãªã£ã¦ãã¾ãã
OSSã®ã¢ã¯ã·ã§ã³ãå©ç¨ããã ãã§ããã°ãã¯ã¼ã¯ããã¼ã®å®ç¾©ãç¨æããã ãã§ä¸é£ã®ããã»ã¹ãå®è¡ãã¦ããã¾ãã
å ¬å¼ã®ã¢ã¯ã·ã§ã³ãOSSã®ã¢ã¯ã·ã§ã³ã«ã注ç®ãã¦ããã¨ä¾¿å©ãªActionsãè¦ã¤ããããããããã¾ãããã
çµããã«
以ä¸ããAndroidãã¼ã ã§GitHub Actionsã§ãªãªã¼ã¹ä½æ¥ãã¡ãã£ã¨æ¥½ã«ãã話ã§ãããä»å¾ã¯ãiOSã¸ã®æ¨ªå±éãFirebase App Distributionã¸ã®ãã¹ãç¨ãã¤ããªãã¢ããããã¼ãããªã©ãGitHub Actionsã§å®è·µãã¦ãããããªã¨èãã¦ããã¾ããã¾ãé²å±ããã次第ãæ¬ããã°ã§çºä¿¡ãã¦ãããã°ã¨æãã¾ãã ããã¾ã§ãèªã¿é ããããã¨ããããã¾ããã
ãªããã³ãããã§ã¯Androidã¨ã³ã¸ãã¢ãç©æ¥µåéãã¦ãã¾ããæ¯éæ°è»½ã«ãªãã£ã¹ã«éã³ã«ãã¦ããã ããã¨ããããã§ãã ä¸ç·ã«å®¶æã®èª²é¡ã解決ãã¦ããã¾ãããï¼
家æã®èª²é¡ã解決ãããµã¼ãã¹ã®MAUãå¢ããAndroidã¨ã³ã¸ãã¢åéï¼