이 기사에서는 GitLab과 함께 CI/CD pipeline 설정 방법을 안내합니다.
소개
Be sure you have added your Capacitor app first to Capgo, this tutorial just focuses on the upload phase. If you need to add your app to Capgo, you can follow this 튜토리얼.
커밋 규칙
커밋 규칙을 따르기 시작하세요. conventional commits이 규칙을 따르면 도구가 버전 번호를 업그레이드하는 방법을 이해할 수 있습니다. 5분만 투자하면 끝납니다.

GitLab CI/CD for Tag
Create a .gitlab-ci.yml file in the root of your GitLab repository with the following content
stages:
- tag
bump_version:
stage: tag
only:
- main
except:
variables:
- $CI_COMMIT_MESSAGE =~ /^chore\(release\):/
script:
- git config --global user.email "gitlab@yourdomain.com"
- git config --global user.name "GitLab CI/CD"
- git checkout $CI_COMMIT_REF_NAME
- git pull origin $CI_COMMIT_REF_NAME
- npx capacitor-standard-version
- git push origin $CI_COMMIT_REF_NAME --tags
Replace “gitlab@yourdomain.com” and “GitLab CI/CD” with your GitLab email and username in the script section. This configuration triggers the job only on pushes to the main branch and excludes commits with messages starting with “chore(release):”.
GitLab CI/CD for Build
Add another stage to your .gitlab-ci.yml file for the build:
stages:
- deploy
deploy:
stage: deploy
only:
- tags # This job will only run for tag pushes
script:
- apt-get update -qy && apt-get install -y nodejs npm
- npm install -g @capgo/cli
- npm ci
- npm run build
- npx @capgo/cli bundle upload -a $CAPGO_TOKEN -c production
variables:
FIREBASE_CONFIG: $FIREBASE_CONFIG # Define this in your GitLab project settings
environment:
name: production
Ensure you have your Capgo API key (CAPGO_TOKEN) added as a CI/CD variable in your GitLab project. Go to your project in GitLab, navigate to Settings > CI/CD > Variables, and add a variable named CAPGO_TOKEN with your API key value.
Customize the build script to match your specific project’s build process, such as changing the npm run build command.
결론
우리는 기술 여정을 한 걸음 더 나아갔습니다. 현대 소프트웨어 개발에서 CICD는 고려해야 할 중요한 요소입니다. 따라서 이 안내서가 모든 사람에게 의미가 있기를 바랍니다.