Skip to content

Commit aa96786

Browse files
ci: Change creation of release
1 parent 0d86f96 commit aa96786

File tree

12 files changed

+136
-127
lines changed

12 files changed

+136
-127
lines changed

.github/workflows/auto-assignee.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99

1010
jobs:
1111
assign-author:
12-
runs-on: self-hosted
12+
runs-on: ubuntu-latest
1313
timeout-minutes: 3
1414
steps:
1515
- uses: toshimaru/[email protected]
+104-31
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,143 @@
1-
name: Bump Version
1+
name: Bump Version, Create Changlog, Create Tag
22

33
on:
44
workflow_dispatch:
5-
65

76
concurrency:
8-
group: "${{ github.ref }}_tag"
9-
cancel-in-progress: true
7+
group: "${{ github.ref }}_bump"
8+
cancel-in-progress: false
109

1110
env:
12-
GITHUB_TOKEN: ${{ secrets.CI_BOT_PAT }}
11+
VERSION_FILE: "Configuration/Version.xcconfig"
12+
GITHUB_EMAIL: "[email protected]"
13+
GITHUB_USERNAME: "nthState-bot"
1314

1415
jobs:
15-
bumpandtag:
16-
name: Nightly Tag Build
17-
runs-on: self-hosted
18-
timeout-minutes: 30
19-
defaults:
20-
run:
21-
working-directory: ./ios
16+
bumpchangelogtag:
17+
name: Bump Version, Create Changlog, Create Tag
18+
runs-on: ubuntu-latest
19+
timeout-minutes: 3
2220
steps:
2321

2422
- name: Checkout
2523
uses: actions/checkout@v3
2624
with:
2725
fetch-depth: 0
28-
token: ${{ secrets.CI_BOT_PAT }}
26+
token: ${{ secrets.ORG_BOT_PAT }}
2927

3028
- name: Find version, build number and update
3129
run: |
3230
# Find build number and increment
33-
CURRENT_PROJECT_VERSION=$(grep -w "CURRENT_PROJECT_VERSION" "Configuration/Version.xcconfig" | cut -d'=' -f2 | tr -d ' ')
31+
CURRENT_PROJECT_VERSION=$(grep -w "CURRENT_PROJECT_VERSION" "${{ env.VERSION_FILE }}" | cut -d'=' -f2 | tr -d ' ')
3432
((CURRENT_PROJECT_VERSION+=1))
35-
sed -i '' "s/\(CURRENT_PROJECT_VERSION *= *\).*/\1$CURRENT_PROJECT_VERSION/" "Configuration/Version.xcconfig"
33+
sed -i "s/\(CURRENT_PROJECT_VERSION *= *\).*/\1$CURRENT_PROJECT_VERSION/" "${{ env.VERSION_FILE }}"
3634
3735
# Find version number
38-
MARKETING_VERSION=$(grep -w "MARKETING_VERSION" "Configuration/Version.xcconfig" | cut -d'=' -f2 | tr -d ' ')
36+
MARKETING_VERSION=$(grep -w "MARKETING_VERSION" "${{ env.VERSION_FILE }}" | cut -d'=' -f2 | tr -d ' ')
3937
4038
NEW_TAG="v$MARKETING_VERSION+$CURRENT_PROJECT_VERSION"
4139
echo $NEW_TAG
4240
4341
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV
4442
echo "BUILD_NUMBER=$CURRENT_PROJECT_VERSION" >> $GITHUB_ENV
4543
44+
45+
- name: Setup Git user
46+
run: |
47+
git config --global user.email "${{ env.GITHUB_EMAIL }}"
48+
git config --global user.name "${{ env.GITHUB_USERNAME }}"
49+
git config --global --add --bool push.autoSetupRemote true
50+
51+
- name: Create tag
52+
run: |
53+
git tag ${{ env.NEW_TAG }}
54+
git push origin ${{ env.NEW_TAG }}
55+
56+
- name: Create Branch
57+
run: |
58+
git checkout -b release/${{ env.NEW_TAG }}
59+
4660
- name: Commit build number
61+
env:
62+
GH_TOKEN: ${{ secrets.ORG_BOT_PAT }}
4763
run: |
48-
git config --global user.email "${{ secrets.CI_BOT_EMAIL }}"
49-
git config --global user.name "${{ secrets.CI_BOT_NAME }}"
50-
git add "Configuration/Version.xcconfig"
51-
git commit -m "bump: Build Number for nightly build ${{ env.NEW_TAG }} [skip ci]" || echo "No changes to commit"
52-
git push
64+
git checkout release/${{ env.NEW_TAG }}
65+
git add "${{ env.VERSION_FILE }}"
66+
git commit -m "bump: Build Number to build ${{ env.NEW_TAG }} [skip ci]" || echo "No changes to commit"
67+
git push
68+
git checkout main
69+
git pull
5370
71+
- name: Update CHANGELOG
72+
id: changelog
73+
uses: Requarks/[email protected]
74+
with:
75+
tag: ${{ env.NEW_TAG }}
76+
excludeTypes: ""
77+
includeInvalidCommits: true
78+
token: ${{ secrets.ORG_BOT_PAT }}
79+
80+
- name: Delete tag
81+
run: |
82+
git tag -d ${{ env.NEW_TAG }}
83+
git push --delete origin ${{ env.NEW_TAG }}
84+
85+
- name: Show whats new
86+
run: |
87+
echo "${{ steps.changelog.outputs.changes }}"
88+
89+
- name: Commit CHANGELOG.md
90+
env:
91+
GH_TOKEN: ${{ secrets.ORG_BOT_PAT }}
92+
run: |
93+
git checkout release/${{ env.NEW_TAG }}
94+
git add "CHANGELOG.md"
95+
git commit -m "docs: update CHANGELOG.md for ${{ env.NEW_TAG }} [skip ci]" || echo "No changes to commit"
96+
git push
97+
98+
- name: Create PR
99+
env:
100+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
run: |
102+
PR_URL=$(gh pr create --base main --head release/${{ env.NEW_TAG }} --title "build: release/${{ env.NEW_TAG }}" --body "BOT: build: release/${{ env.NEW_TAG }}")
103+
echo $PR_URL
104+
echo "PR_URL=$PR_URL" >> $GITHUB_ENV
105+
106+
- name: Approve PR
107+
env:
108+
GH_TOKEN: ${{ secrets.ORG_BOT_PAT }}
109+
run: |
110+
gh pr review --approve ${{ env.PR_URL }}
111+
112+
- name: Merge PR
113+
env:
114+
GH_TOKEN: ${{ secrets.ORG_BOT_PAT }}
115+
run: |
116+
#gh pr merge --squash ${{ env.PR_URL }}
117+
54118
- name: Create tag
55119
run: |
120+
git checkout main
121+
git pull
56122
git tag ${{ env.NEW_TAG }}
57123
git push origin ${{ env.NEW_TAG }}
58124
59-
outputs:
60-
NEW_TAG: ${{ env.NEW_TAG }}
61-
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
125+
- name: Create Release
126+
uses: softprops/action-gh-release@v1
127+
with:
128+
tag_name: ${{ env.NEW_TAG }}
129+
draft: false
130+
name: ${{ env.NEW_TAG }}
131+
body: ${{ steps.changelog.outputs.changes }}
132+
token: ${{ secrets.ORG_BOT_PAT }}
62133

134+
- name: Revert on failure
135+
if: ${{ failure() }}
136+
run: |
137+
git checkout main
138+
git tag -d ${{ env.NEW_TAG }}
139+
git push --delete origin ${{ env.NEW_TAG }}
140+
git branch -D release/${{ env.NEW_TAG }}
141+
git push origin --delete release/${{ env.NEW_TAG }}
63142
64-
createrelease:
65-
needs: bumpandtag
66-
uses: ./.github/workflows/build-create-release.yml
67-
secrets: inherit
68-
with:
69-
tag_name: ${{ needs.bumpandtag.outputs.NEW_TAG }}
70-
build_number: ${{ needs.bumpandtag.outputs.BUILD_NUMBER }}
143+

.github/workflows/build-create-release.yml

-60
This file was deleted.

.github/workflows/build.yml

+21-25
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
env:
14-
PACKAGE_NAME=Accordion
15-
REPOSITORY_NAME=Accordion
16-
OUTPUT_PATH=./docs
17-
DEVELOPER_DIR: /Applications/Xcode_15_beta2.app/Contents/Developer
14+
GITHUB_EMAIL: "[email protected]"
15+
GITHUB_USERNAME: "nthState-bot"
16+
PACKAGE_NAME: CurtainRaiser
17+
REPOSITORY_NAME: CurtainRaiser
18+
OUTPUT_PATH: ./docs
19+
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
1820

1921
jobs:
2022
build:
2123
name: Build
22-
runs-on: self-hosted
24+
runs-on: macos-13
2325
timeout-minutes: 5
2426
steps:
2527

@@ -29,42 +31,36 @@ jobs:
2931
- name: Build Package
3032
run: swift build
3133

32-
test:
33-
name: Test
34-
runs-on: self-hosted
35-
timeout-minutes: 5
36-
steps:
37-
38-
- name: Checkout
39-
uses: actions/checkout@v3
40-
41-
- name: Build Package
34+
- name: Test Package
4235
run: swift test
43-
36+
4437
buildDocs:
4538
name: Build Docs
46-
needs: Build
47-
runs-on: self-hosted
39+
needs: build
40+
runs-on: macos-13
4841
if: github.ref != 'refs/heads/main'
4942
timeout-minutes: 5
5043
steps:
5144

5245
- name: Checkout
5346
uses: actions/checkout@v3
47+
with:
48+
fetch-depth: 0
49+
token: ${{ secrets.ORG_BOT_PAT }}
5450

5551
- name: Generate Documentation
5652
run: |
57-
swift package --allow-writing-to-directory $OUTPUT_PATH \
58-
generate-documentation --target $PACKAGE_NAME \
53+
swift package --allow-writing-to-directory ${{ env.OUTPUT_PATH }} \
54+
generate-documentation --target ${{ env.PACKAGE_NAME }} \
5955
--disable-indexing \
6056
--transform-for-static-hosting \
61-
--hosting-base-path $REPOSITORY_NAME \
62-
--output-path $OUTPUT_PATH
57+
--hosting-base-path ${{ env.REPOSITORY_NAME }} \
58+
--output-path ${{ env.OUTPUT_PATH }}
6359
6460
- name: Commit Documentation
6561
run: |
66-
git config --global user.email "${{ secrets.CI_BOT_EMAIL }}"
67-
git config --global user.name "${{ secrets.CI_BOT_NAME }}"
68-
git add $OUTPUT_PATH
62+
git config --global user.email "${{ env.GITHUB_EMAIL }}"
63+
git config --global user.name "${{ env.GITHUB_USERNAME }}"
64+
git add "${{ env.OUTPUT_PATH }}"
6965
git commit -m "docs: Update docs [skip ci]" || echo "No changes to commit"
7066
git push

.github/workflows/check-pr-title.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ concurrency:
1010

1111
jobs:
1212
check:
13-
runs-on: self-hosted
13+
runs-on: ubuntu-latest
1414
timeout-minutes: 3
1515
steps:
1616
- name: Check PR Title

.github/workflows/lint.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
env:
14-
DEVELOPER_DIR: /Applications/Xcode_15_beta2.app/Contents/Developer
14+
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer
1515

1616
jobs:
1717
lint:
1818
name: SwiftLint
19-
runs-on: self-hosted
19+
runs-on: macos-13
2020
timeout-minutes: 5
2121
steps:
2222

.github/workflows/workflow-cleanup.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ concurrency:
1212
jobs:
1313
cleanup:
1414
name: Clean up Workflows
15-
runs-on: self-hosted
15+
runs-on: ubuntu-latest
1616
timeout-minutes: 15
1717
steps:
1818

@@ -22,4 +22,4 @@ jobs:
2222
repository: ${{ github.repository }}
2323
older-than-seconds: 259200 # 3 days
2424
env:
25-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
GITHUB_TOKEN: ${{ secrets.ORG_BOT_PAT }}

Configuration/Version.xcconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
// Copyright © nthState Ltd 2023. All rights reserved.
33
//
44

5-
CURRENT_PROJECT_VERSION = 1
5+
CURRENT_PROJECT_VERSION = 0
66
MARKETING_VERSION = 0.0.0

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PackageDescription
55
let package = Package(
66
name: "CurtainRaiser",
77
defaultLocalization: "en",
8-
platforms: [.iOS(.v17), .macOS(.v14), .visionOS(.v1)],
8+
platforms: [.iOS(.v17), .macOS(.v14)],
99
products: [
1010
.library(
1111
name: "CurtainRaiser",

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ When we create a new release, CI will:
186186

187187
## Older Attempts <a name="older-attempts"></a>
188188

189-
If you `git checkout 9ee2a232943cd4e094382e4cb82120be76ea9c99` you can see that I tried to create this effect
189+
If you `git checkout` [9ee2a232943cd4e094382e4cb82120be76ea9c99](https://github.com/nthState/CurtainRaiser/commit/9ee2a232943cd4e094382e4cb82120be76ea9c99) you can see that I tried to create this effect
190190
with projection/view/model matrix, by rotating each section and putting that section in the correct place.
191191

192192
Whilst it initially looked ok, the perspective always failed.

0 commit comments

Comments
 (0)