ci: iterating on gh-actions #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- master | |
- test-github-actions | |
jobs: | |
build: | |
runs-on: macos-12 | |
environment: production | |
steps: | |
- name: Dump gitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJSON(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Set up node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Set up xcode | |
run: sudo xcode-select -s /Applications/Xcode_13.4.1.app/Contents/Developer | |
- name: Calculate checkout fetch-depth | |
id: pre-checkout | |
env: | |
COMMITS: ${{ toJson(github.event.commits) }} | |
run: | | |
if [[ "${{ github.event_name }}" == "push" ]]; then | |
COUNT=$(( $(echo "$COMMITS" | jq length) + 1 )) | |
else | |
COUNT=1 | |
fi | |
echo "fetch-depth=$COUNT" >> "$GITHUB_OUTPUT" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: ${{ steps.pre-checkout.outputs.fetch-depth }} | |
- name: Set up environment variables | |
run: | | |
echo "IS_RELEASE=$(if [ \"$GITHUB_REF_NAME\" = \"master\" -a \"$GITHUB_EVENT_NAME\" = \"push\" ]; then echo true; else echo false; fi)" >> $GITHUB_ENV | |
echo "XCODE_BUILD_PATH=DerivedData/Build/Products/Release" >> $GITHUB_ENV | |
echo "VERSION_FILE=VERSION.txt" >> $GITHUB_ENV | |
echo "APP_NAME=$(awk -F ' = ' '/PRODUCT_NAME/ { print $2; }' < config/base.xcconfig)" >> $GITHUB_ENV | |
- name: Run print-env.sh | |
run: | | |
scripts/print_env.sh | |
- name: Run ci_cd.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
APPCENTER_SECRET: ${{ secrets.APPCENTER_SECRET }} | |
APPCENTER_TOKEN: ${{ secrets.APPCENTER_TOKEN }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
APPLE_P12_CERTIFICATE: ${{ secrets.APPLE_P12_CERTIFICATE }} | |
APPLE_P12_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_P12_CERTIFICATE_PASSWORD }} | |
# FEEDBACK_TOKEN: ${{ secrets.FEEDBACK_TOKEN }} | |
# GITHUB_SSH_KEY: ${{ secrets.GITHUB_SSH_KEY }} | |
# NETLIFY_WEBHOOK: ${{ secrets.NETLIFY_WEBHOOK }} | |
# SPARKLE_ED_PRIVATE_KEY: ${{ secrets.SPARKLE_ED_PRIVATE_KEY }} | |
BUILD_DIR: ${{ github.workspace }} | |
GITHUB_EVENT_BEFORE: ${{ github.event.before }} | |
GITHUB_EVENT_AFTER: ${{ github.event.after }} | |
run: | | |
scripts/pre_build_checks.sh | |
scripts/ci_cd.sh | |
# - name: Deploy to github releases | |
## env: | |
## GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# files: ${{ env.XCODE_BUILD_PATH }}/*.zip | |
# - name: Run after_deploy.sh | |
# run: | | |
# scripts/after_deploy.sh |