|
| 1 | +name: CI/CD |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [ main ] |
| 8 | + schedule: |
| 9 | + - cron: '0 0 * * *' |
| 10 | + workflow_dispatch: |
| 11 | + inputs: |
| 12 | + release: |
| 13 | + description: Create release |
| 14 | + required: false |
| 15 | + type: boolean |
| 16 | + version: |
| 17 | + description: New version to release |
| 18 | + required: false |
| 19 | + type: string |
| 20 | + |
| 21 | +concurrency: |
| 22 | + group: ci/cd-${{ github.ref }} |
| 23 | + cancel-in-progress: true |
| 24 | + |
| 25 | +jobs: |
| 26 | + analyze: |
| 27 | + name: Analyze |
| 28 | + if: github.event_name != 'workflow_dispatch' |
| 29 | + uses: SwiftyLab/ci/.github/workflows/analyze.yml@main |
| 30 | + permissions: |
| 31 | + actions: read |
| 32 | + contents: read |
| 33 | + security-events: write |
| 34 | + with: |
| 35 | + matrix: > |
| 36 | + { |
| 37 | + "include": [ |
| 38 | + { |
| 39 | + "os": "ubuntu-latest", |
| 40 | + "language": "swift", |
| 41 | + "swift": "5.9" |
| 42 | + }, |
| 43 | + { |
| 44 | + "os": "macos-13", |
| 45 | + "language": "swift", |
| 46 | + "xcode": "15" |
| 47 | + } |
| 48 | + ] |
| 49 | + } |
| 50 | +
|
| 51 | + # spell-check: |
| 52 | + # name: Run spell check |
| 53 | + # runs-on: ubuntu-latest |
| 54 | + # steps: |
| 55 | + # - name: Checkout repository |
| 56 | + # uses: actions/checkout@v3 |
| 57 | + |
| 58 | + # - name: Spellcheck Action |
| 59 | + # uses: rojopolis/[email protected] |
| 60 | + # with: |
| 61 | + # config_path: .github/config/spellcheck.yml |
| 62 | + |
| 63 | + swift-package-test: |
| 64 | + name: Swift Package |
| 65 | + uses: SwiftyLab/ci/.github/workflows/swift-package.yml@main |
| 66 | + secrets: inherit |
| 67 | + with: |
| 68 | + matrix: > |
| 69 | + { |
| 70 | + "include": [ |
| 71 | + { |
| 72 | + "os": "ubuntu-latest", |
| 73 | + "swift": "5.9" |
| 74 | + }, |
| 75 | + { |
| 76 | + "os": ""macos-13", |
| 77 | + "xcode": "15" |
| 78 | + } |
| 79 | + ] |
| 80 | + } |
| 81 | + # { |
| 82 | + # "os": "windows-latest", |
| 83 | + # "swift": "5.9" |
| 84 | + # } |
| 85 | + |
| 86 | + ci: |
| 87 | + name: CI |
| 88 | + if: github.event_name == 'push' |
| 89 | + needs: [analyze, swift-package-test] |
| 90 | + uses: SwiftyLab/ci/.github/workflows/ci.yml@main |
| 91 | + |
| 92 | + cd: |
| 93 | + name: CD |
| 94 | + if: | |
| 95 | + (github.event_name == 'push' && needs.ci.outputs.release == 'true') || |
| 96 | + (always() && |
| 97 | + github.event_name == 'workflow_dispatch' && |
| 98 | + github.event.inputs.release == 'true' && |
| 99 | + needs.swift-package-test.result == 'success' && |
| 100 | + (needs.ci.result == 'success' || needs.ci.result == 'skipped') && |
| 101 | + (needs.analyze.result == 'success' || needs.analyze.result == 'skipped')) |
| 102 | + needs: [analyze, swift-package-test, ci] |
| 103 | + uses: SwiftyLab/ci/.github/workflows/cd.yml@main |
| 104 | + with: |
| 105 | + version: ${{ github.event.inputs.version }} |
| 106 | + secrets: |
| 107 | + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} |
0 commit comments