Skip to content
This repository was archived by the owner on Feb 14, 2025. It is now read-only.

Commit 8482215

Browse files
committed
Automate the release
1 parent c084a76 commit 8482215

File tree

3 files changed

+95
-5
lines changed

3 files changed

+95
-5
lines changed

.github/workflows/release.yml

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: VirtualOS
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: release-${{ github.head_ref }}
10+
cancel-in-progress: true
11+
12+
env:
13+
MISE_EXPERIMENTAL: "1"
14+
15+
jobs:
16+
build:
17+
name: "Build"
18+
runs-on: "macos-13"
19+
steps:
20+
- uses: actions/checkout@v4
21+
- id: skip_release
22+
run: |
23+
# Get the commit message of the latest commit
24+
commit_message=$(git log -1 --pretty=format:%s)
25+
echo "Commit message: $commit_message"
26+
# Check if the commit message starts with 'release'
27+
if [[ "$commit_message" == release* ]]; then
28+
echo "SKIP_RELEASE=true" >> $GITHUB_ENV
29+
else
30+
echo "SKIP_RELEASE=false" >> $GITHUB_ENV
31+
fi
32+
- uses: jdx/mise-action@v2
33+
if: steps.skip_release.outputs.SKIP_RELEASE == 'false'
34+
- run: mise run install
35+
if: steps.skip_release.outputs.SKIP_RELEASE == 'false'
36+
- name: bundle
37+
if: steps.skip_release.outputs.SKIP_RELEASE == 'false'
38+
env:
39+
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
40+
APPLE_ID: ${{ secrets.APPLE_ID }}
41+
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
42+
CERTIFICATE_ENCRYPTION_PASSWORD: ${{ secrets.CERTIFICATE_ENCRYPTION_PASSWORD }}
43+
TUIST_CONFIG_TOKEN: ${{ secrets.TUIST_CONFIG_TOKEN }}
44+
run: mise run bundle
45+
- name: Get next version
46+
if: steps.skip_release.outputs.SKIP_RELEASE == 'false'
47+
id: version
48+
run: |
49+
echo "VERSION=$(git cliff --bumped-version)" >> $GITHUB_ENV
50+
- name: Generate changelog
51+
if: steps.skip_release.outputs.SKIP_RELEASE == 'false'
52+
id: changelog
53+
run: |
54+
git-cliff --bump -o CHANGELOG.md
55+
- name: Generate release notes
56+
if: steps.skip_release.outputs.SKIP_RELEASE == 'false'
57+
id: release-notes
58+
run: |
59+
echo "RELEASE_NOTES=$(git cliff --latest)" >> $GITHUB_ENV
60+
- uses: stefanzweifel/git-auto-commit-action@v5
61+
if: steps.skip_release.outputs.SKIP_RELEASE == 'false'
62+
with:
63+
commit_message: release ${{ steps.version.outputs.VERSION }}
64+
- name: Release
65+
uses: softprops/action-gh-release@v2
66+
if: steps.skip_release.outputs.SKIP_RELEASE == 'false'
67+
with:
68+
body: ${{ steps.release-notes.outputs.RELEASE_NOTES }}
69+
draft: false
70+
name: ${{ steps.version.outputs.VERSION }}
71+
tag_name: ${{ steps.version.outputs.VERSION }}
72+
make_latest: true
73+
files: |
74+
build/artifacts/virtualos.zip
75+
build/artifacts/SHASUMS256.txt
76+
build/artifacts/SHASUMS512.txt
77+
78+

.github/workflows/virtualos.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,15 @@ jobs:
3434
- uses: jdx/mise-action@v2
3535
with:
3636
experimental: true
37-
- name: Run
37+
- run: mise run install
38+
- name: bundle
3839
env:
3940
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
4041
APPLE_ID: ${{ secrets.APPLE_ID }}
4142
APP_SPECIFIC_PASSWORD: ${{ secrets.APP_SPECIFIC_PASSWORD }}
4243
CERTIFICATE_ENCRYPTION_PASSWORD: ${{ secrets.CERTIFICATE_ENCRYPTION_PASSWORD }}
4344
TUIST_CONFIG_TOKEN: ${{ secrets.TUIST_CONFIG_TOKEN }}
44-
run: |
45-
mise run install
46-
mise run bundle
45+
run: mise run bundle
4746

4847
test:
4948
name: "Test"

.mise/tasks/bundle

+14-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ CERTIFICATE_PATH=$TMP_DIRECTORY/certificate.p12
1414
BUILD_DIRECTORY=$MISE_PROJECT_ROOT/build
1515
DERIVED_DATA_PATH=$BUILD_DIRECTORY/derived
1616
BUILD_DIRECTORY_BINARY=$DERIVED_DATA_PATH/Build/Products/Release/virtualos
17-
BUILD_ZIP_PATH=$DERIVED_DATA_PATH/virtualos.zip
17+
BUILD_ARTIFACTS_DIRECTORY=$BUILD_DIRECTORY/artifacts
18+
BUILD_ZIP_PATH=$BUILD_ARTIFACTS_DIRECTORY/virtualos.zip
19+
SHASUMS256_FILE=$BUILD_ARTIFACTS_DIRECTORY/SHASUMS256.txt
20+
SHASUMS512_FILE=$BUILD_ARTIFACTS_DIRECTORY/SHASUMS512.txt
1821
TEAM_ID='U6LC622NKF'
1922
GREEN='\033[0;32m'
2023
YELLOW='\033[1;33m'
@@ -45,6 +48,7 @@ codesign --force --options runtime --sign "Developer ID Application: Tuist GmbH
4548

4649
# Notarize
4750
print_status "Submitting virtualos for notarization..."
51+
mkdir -p $BUILD_ARTIFACTS_DIRECTORY
4852
ditto -c -k --keepParent $BUILD_DIRECTORY_BINARY $BUILD_ZIP_PATH
4953
SUBMISSION_ID=$(xcrun notarytool submit "${BUILD_ZIP_PATH}" \
5054
--apple-id "$APPLE_ID" \
@@ -82,3 +86,12 @@ while true; do
8286
;;
8387
esac
8488
done
89+
90+
# Generathing shasums
91+
print_status "Generating shasums..."
92+
for file in "$BUILD_ARTIFACTS_DIRECTORY"/*; do
93+
if [ -f "$file" ] && [[ $(basename "$file") != SHASUMS* ]]; then
94+
shasum -a 256 "$file" | awk '{print $1 " " FILENAME}' FILENAME=$(basename "$file") >> $SHASUMS256_FILE
95+
shasum -a 512 "$file" | awk '{print $1 " " FILENAME}' FILENAME=$(basename "$file") >> $SHASUMS512_FILE
96+
fi
97+
done

0 commit comments

Comments
 (0)