stages:
  - test
  - build

test-job:
  stage: test
  tags:
    - macos
  script:
    - xcodebuild clean test -project ACShell.xcodeproj -scheme ACShell

build-job:
  stage: build
  tags:
    - macos
  script:
    - xcodebuild clean build -project ACShell.xcodeproj -scheme ACShell -configuration release -derivedDataPath ./DerivedData APPLICATION_BUILD_NUMBER=$CI_BUILD_ID
    - cd package_dmg && ./package.sh "ACShell-Release-789" "../DerivedData/Build/Products/Release/ACShell.app"
  artifacts:
    expire_in: 2 weeks
    paths:
      - $CI_PROJECT_DIR/package_dmg/*.dmg
  # rules:
  #   - if: $CI_COMMIT_TAG != null
  #     when: always
  #   - if: $CI_COMMIT_TAG == null
  #     when: manual

stages:
  - test
  - build

test-job:
  stage: test
  tags:
    - macos
  script:
    - xcodebuild clean test -project ACShell.xcodeproj -scheme ACShell

build-job:
  stage: build
  tags:
    - macos
  script:
    - xcodebuild clean build -project ACShell.xcodeproj -scheme ACShell -configuration release -derivedDataPath ./DerivedData APPLICATION_BUILD_NUMBER=$CI_BUILD_ID
    - cd package_dmg && ./package.sh "ACShell-Release-$CI_COMMIT_TAG" "../DerivedData/Build/Products/Release/ACShell.app"
  artifacts:
    expire_in: 2 weeks
    paths:
      - $CI_PROJECT_DIR/package_dmg/*.dmg
  rules:
    - if: $CI_COMMIT_TAG != null
      when: always
    - if: $CI_COMMIT_TAG == null
      when: manual

Build dmg from commit tag.
Build dmg from commit tag.
