@@ -12,6 +12,9 @@ concurrency:
1212 group : ${{ github.ref_name }}
1313 cancel-in-progress : true
1414
15+ permissions :
16+ contents : write
17+
1518jobs :
1619 test-configure-script :
1720 name : Test configure.swift script and generate project
@@ -49,72 +52,44 @@ jobs:
4952 with :
5053 name : generated-project
5154 path : OUTPUT/TestModule/
52- test -generated-project-swift-package :
53- name : Test generated project - ${{ matrix.name }}
55+ deploy -generated-project :
56+ name : Deploy generated project to test branch
5457 needs : test-configure-script
55- runs-on : ${{ matrix.runsOn }}
56- env :
57- DEVELOPER_DIR : " /Applications/${{ matrix.xcode }}.app/Contents/Developer"
58+ runs-on : ubuntu-latest
5859 timeout-minutes : 10
59- strategy :
60- fail-fast : false
61- matrix :
62- include :
63- - xcode : " Xcode_16.3"
64- runsOn : macos-latest
65- name : " macOS, Xcode 16.3, Swift 6.1"
66- - xcode : " Xcode_15.4"
67- runsOn : macos-14
68- name : " macOS 14, Xcode 15.4, Swift 5.10"
69- - xcode : " Xcode_15.2"
70- runsOn : macos-13
71- name : " macOS 13, Xcode 15.2, Swift 5.9.2"
60+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
7261 steps :
7362 - uses : actions/checkout@v4
74-
75- - name : Download generated project
76- uses : actions/download-artifact@v4
7763 with :
78- name : generated-project
79- path : TestModule/
64+ token : ${{ secrets.GITHUB_TOKEN }}
8065
81- - name : Swift Package Test
82- run : |
83- set -o pipefail
84- cd TestModule
85- swift build
86- swift test
87-
88- test-generated-project-example-app :
89- name : Test generated project Example App - ${{ matrix.name }}
90- needs : test-configure-script
91- runs-on : ${{ matrix.runsOn }}
92- env :
93- DEVELOPER_DIR : " /Applications/${{ matrix.xcode }}.app/Contents/Developer"
94- timeout-minutes : 10
95- strategy :
96- fail-fast : false
97- matrix :
98- include :
99- - xcode : " Xcode_16.3"
100- runsOn : macos-latest
101- name : " iOS Simulator"
102- destination : " platform=iOS Simulator,name=iPhone 15 Pro"
103- - xcode : " Xcode_15.4"
104- runsOn : macos-14
105- name : " iOS Simulator"
106- destination : " platform=iOS Simulator,name=iPhone 15 Pro"
107- steps :
108- - uses : actions/checkout@v4
109-
11066 - name : Download generated project
11167 uses : actions/download-artifact@v4
11268 with :
11369 name : generated-project
114- path : TestModule/
70+ path : deployment-content/
71+
72+ - name : Configure Git
73+ run : |
74+ git config --global user.name "GitHub Actions"
75+ git config --global user.email "[email protected] " 11576
116- - name : Build Example App
77+ - name : Deploy to deployment branch
11778 run : |
118- set -o pipefail
119- cd TestModule/Example
120- xcodebuild -project Example.xcodeproj -scheme Example -destination "${{ matrix.destination }}" clean build
79+ # Create deployment branch (or reset if exists)
80+ git checkout --orphan deployment || git checkout deployment
81+
82+ # Remove all existing content
83+ git rm -rf . || true
84+
85+ # Copy generated project content to root
86+ cp -r deployment-content/* .
87+
88+ # Add all files
89+ git add .
90+
91+ # Create commit
92+ git commit -m "Deploy generated project from commit ${{ github.sha }}"
93+
94+ # Force push to deployment branch
95+ git push origin deployment --force
0 commit comments