Skip to content

Commit e30f16f

Browse files
committed
🤙 Update CI files to use shared workflow
1 parent 3dc7114 commit e30f16f

File tree

2 files changed

+31
-49
lines changed

2 files changed

+31
-49
lines changed

.github/workflows/check.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,52 @@
1-
name: check
1+
name: check
22
on: push
33
jobs:
44
lint:
5-
name: lint
6-
runs-on: macOS-latest
5+
name: 🧹 lint
6+
runs-on: macos-latest
77
steps:
8-
- name: Checkout
8+
- name: ⬇️ Checkout
99
uses: actions/checkout@master
1010
with:
1111
fetch-depth: 1
12-
- name: Install swiftlint
12+
- name: ⚙️ Install swiftlint
1313
run: |
1414
brew install swiftlint
1515
env:
1616
HOMEBREW_NO_INSTALL_CLEANUP: 1
17-
- name: Code Lint
17+
- name: 🧹 Code Lint
1818
run: |
19+
if [ ! -f ".swiftlint.yml" ]; then
20+
curl -L https://raw.githubusercontent.com/4d-for-ios/check-workflow/master/form/quality/.swiftlint.yml --output .swiftlint.yml
21+
fi
1922
swiftlint --strict
20-
- name: Install iblinter
23+
- name: ⚙️ Install iblinter
2124
run: |
2225
brew install IBDecodable/homebrew-tap/iblinter
2326
env:
2427
HOMEBREW_NO_INSTALL_CLEANUP: 1
25-
- name: Storyboard Lint
28+
- name: 🧹 Storyboard Lint
2629
run: |
30+
if [ ! -f ".iblinter.yml" ]; then
31+
curl -L https://raw.githubusercontent.com/4d-for-ios/check-workflow/master/form/quality/.iblinter.yml --output .iblinter.yml
32+
fi
2733
iblinter lint
28-
- name: Install jsonlint
34+
- name: ⚙️ Install jsonlint
2935
run: |
3036
brew install jsonlint | tee
31-
- name: Manifest Lint
37+
- name: 🧹 Manifest Lint
3238
run: |
3339
cat manifest.json | jsonlint
3440
build:
35-
name: build
36-
runs-on: macOS-latest
41+
name: 🏗 build
42+
runs-on: macos-latest
43+
env:
44+
RELEASE_REPO: "https://raw.githubusercontent.com/4d-for-ios/check-workflow/master"
3745
steps:
38-
- name: Checkout
46+
- name: ⬇️ Checkout
3947
uses: actions/checkout@master
4048
with:
4149
fetch-depth: 1
42-
- name: Swift build
50+
- name: 👷 Swift build
4351
run: |
44-
sdk=`xcrun -sdk iphonesimulator -show-sdk-path`
45-
sdkVersion=`echo $sdk | sed -E 's/.*iPhoneSimulator(.*)\.sdk/\1/'`
46-
swift build -Xswiftc "-sdk" -Xswiftc "$sdk" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios$sdkVersion-simulator"
52+
curl -fsSL $RELEASE_REPO/form/scripts/swift_build.sh | bash -s

.github/workflows/release.yml

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,24 @@
1-
name: Upload artifact
1+
name: 🚀 release
22
on:
33
release:
44
types: [published]
55
jobs:
66
publish:
77
name: Publish
8-
runs-on: macOS-latest
8+
runs-on: macos-latest
9+
env:
10+
RELEASE_REPO: "https://raw.githubusercontent.com/4d-for-ios/check-workflow/master/form/scripts"
911
steps:
1012
- name: ⬇️ Checkout
1113
uses: actions/checkout@master
1214
- name: 📝 Edit manifest
1315
run: |
14-
echo "Edit manifest to release and repository metadata"
15-
GITHUB_URL="https://github.com/$GITHUB_REPOSITORY"
16-
echo "➕ home page: $GITHUB_URL"
17-
cat <<< "$(jq ".homepage = \"$GITHUB_URL\"" < manifest.json)" > manifest.json
18-
REPOSITORY_NAME=$(jq --raw-output '.repository.name' $GITHUB_EVENT_PATH)
19-
DOWNLOAD_URL="$GITHUB_URL/releases/latest/download/$REPOSITORY_NAME.zip"
20-
echo "➕update url: $DOWNLOAD_URL"
21-
cat <<< "$(jq ".updateURL = \"$DOWNLOAD_URL\"" < manifest.json)" > manifest.json
22-
RELEASE_TAG=$(jq --raw-output '.release.tag_name' $GITHUB_EVENT_PATH)
23-
echo "➕ tag: $RELEASE_TAG"
24-
cat <<< "$(jq ".version = \"$RELEASE_TAG\"" < manifest.json)" > manifest.json
25-
26-
jq -s '.[0] * .[1]' manifest.json $GITHUB_EVENT_PATH > manifest.merged.json
27-
rm manifest.json
28-
mv manifest.merged.json manifest.json
16+
curl -fsSL $RELEASE_REPO/release_manifest.sh | bash -s $GITHUB_REPOSITORY $GITHUB_EVENT_PATH
2917
- name: 📦 Build archive
3018
run: |
31-
REPOSITORY_NAME=$(jq --raw-output '.repository.name' $GITHUB_EVENT_PATH)
32-
zip -r $REPOSITORY_NAME.zip . -x ".*" -x "__MACOSX"
19+
curl -fsSL $RELEASE_REPO/release_archive.sh | bash -s $GITHUB_EVENT_PATH
3320
- name: ⬆️ Upload to Release
3421
run: |
35-
REPOSITORY_NAME=$(jq --raw-output '.repository.name' $GITHUB_EVENT_PATH)
36-
ARTIFACT=./$REPOSITORY_NAME.zip
37-
AUTH_HEADER="Authorization: token $GITHUB_TOKEN"
38-
CONTENT_LENGTH_HEADER="Content-Length: $(stat -f%z "$ARTIFACT")"
39-
CONTENT_TYPE_HEADER="Content-Type: application/zip"
40-
RELEASE_ID=$(jq --raw-output '.release.id' $GITHUB_EVENT_PATH)
41-
FILENAME=$(basename $ARTIFACT)
42-
UPLOAD_URL="https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$FILENAME"
43-
echo "$UPLOAD_URL"
44-
curl -sSL -XPOST \
45-
-H "$AUTH_HEADER" -H "$CONTENT_LENGTH_HEADER" -H "$CONTENT_TYPE_HEADER" \
46-
--upload-file "$ARTIFACT" "$UPLOAD_URL"
22+
curl -fsSL $RELEASE_REPO/release_upload.sh | bash -s $GITHUB_EVENT_PATH $GITHUB_TOKEN
4723
env:
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)