Skip to content

Commit 4a46c46

Browse files
committed
ci: switch to github actions (#1241)
1 parent 9d1349b commit 4a46c46

File tree

9 files changed

+148
-55
lines changed

9 files changed

+148
-55
lines changed

.github/workflows/ci_cd.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
- test-github-actions
6+
env:
7+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8+
APPCENTER_SECRET: ${{ secrets.APPCENTER_SECRET }}
9+
APPCENTER_TOKEN: ${{ secrets.APPCENTER_TOKEN }}
10+
APPLE_ID: ${{ secrets.APPLE_ID }}
11+
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
12+
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
13+
APPLE_P12_CERTIFICATE: ${{ secrets.APPLE_P12_CERTIFICATE }}
14+
FEEDBACK_TOKEN: ${{ secrets.FEEDBACK_TOKEN }}
15+
NETLIFY_WEBHOOK: ${{ secrets.NETLIFY_WEBHOOK }}
16+
SPARKLE_ED_PRIVATE_KEY: ${{ secrets.SPARKLE_ED_PRIVATE_KEY }}
17+
GITHUB_EVENT_BEFORE: ${{ github.event.before }}
18+
GITHUB_EVENT_AFTER: ${{ github.event.after }}
19+
BUILD_DIR: ${{ github.workspace }}
20+
XCODE_BUILD_PATH: DerivedData/Build/Products/Release
21+
VERSION_FILE: VERSION.txt
22+
APP_NAME: AltTab
23+
jobs:
24+
build:
25+
runs-on: macos-12
26+
environment: production
27+
steps:
28+
# - env:
29+
# GITHUB_CONTEXT: ${{ toJSON(github) }}
30+
# run: echo "$GITHUB_CONTEXT"
31+
- run: echo "IS_RELEASE=$(if [ \"$GITHUB_REF_NAME\" = \"master\" -a \"$GITHUB_EVENT_NAME\" = \"push\" ]; then echo true; else echo false; fi)" >> $GITHUB_ENV
32+
- uses: actions/setup-node@v3
33+
with:
34+
node-version: 16
35+
- run: sudo xcode-select -s /Applications/Xcode_13.4.1.app/Contents/Developer
36+
- id: pre-checkout
37+
env:
38+
COMMITS: ${{ toJson(github.event.commits) }}
39+
run: |
40+
if [[ "${{ github.event_name }}" == "push" ]]; then
41+
COUNT=$(( $(echo "$COMMITS" | jq length) + 1 ))
42+
else
43+
COUNT=1
44+
fi
45+
echo "fetch-depth=$COUNT" >> "$GITHUB_OUTPUT"
46+
- uses: actions/checkout@v3
47+
with:
48+
fetch-depth: ${{ steps.pre-checkout.outputs.fetch-depth }}
49+
- run: scripts/print_env.sh
50+
- run: scripts/pre_build_checks.sh
51+
- run: scripts/ci_cd.sh
52+
- id: set_tag_name
53+
run: echo "tag_name=v"$(cat $VERSION_FILE)"" >> "$GITHUB_OUTPUT"
54+
- uses: softprops/action-gh-release@v1
55+
with:
56+
tag_name: ${{ steps.set_tag_name.outputs.tag_name }}
57+
files: ${{ env.XCODE_BUILD_PATH }}/*.zip
58+
- run: scripts/after_deploy.sh

.travis.yml

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
branches:
2-
only:
3-
- master
4-
- develop
5-
os: osx
6-
osx_image: xcode13.4
7-
language: node_js
8-
node_js:
9-
- 16
10-
addons:
11-
ssh_known_hosts: github.com
12-
homebrew:
13-
packages:
14-
- vitorgalvao/tiny-scripts/cask-repair
15-
update: true
16-
env:
17-
global:
18-
- IS_RELEASE=$(if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then echo true; fi)
19-
- XCODE_BUILD_PATH="DerivedData/Build/Products/Release"
20-
- VERSION_FILE="VERSION.txt"
21-
- APP_NAME="$(awk -F ' = ' '/PRODUCT_NAME/ { print $2; }' < config/base.xcconfig)"
22-
install: true # disable default install
23-
script: scripts/travis.sh
24-
before_deploy: if [[ $TRAVIS_TEST_RESULT == 1 ]]; then echo "build failed; exiting to prevent deploy phases"; sleep 2; exit 1; fi
25-
deploy:
26-
provider: releases
27-
token:
28-
secure: wZUHfOs+JQ0ikNMJ8BnM+8fuoQdhgOEQpNd01ueZxe760GAAjSbq1icME8qaYJJMk1G6n14jo9ecEhzxF0XV8hSdy4WtikK7l5SXiOx5Efuh/tNscmHggGk235eLwQD9pglePZsP3xJUB1BHEj260rypkjnSx5kVOfLUeB1ASeg4+KdxZd2vXjwel+YQf+dYbNUYtwoWqjiLbqT1ao+0q04MPgD2c9jb+HnsA94LUGb44lPXqfUJ+xG2LxBpcDW/q1JhFXL/AmJb0dOOEVzzrBqfWysPukgPMONexZse4c3BBqkMI52ZuF3OoEVAffofmuGKiR5OoyU/hW17xi9jGeb79r+Xt4RdaJAgwcn7/7GtemYKUJp8jhLGsy9XZJShENX7UHTkP3L4iyOrd2Wz+ctZWAebyNReLt985/xTaplpDiQrPcKAuQNBa4sgWk5rIsf7Z0tcBfZau/fQl9Q4100xTbwC+GeAbL0IyXG3kVzQGsGllXHr/2JM1sj7rmKA7lmDlp7xiOBCPscn2YCT87U+F6VbYoNvnxne0igQOUwrvX4qa4XlYrUXDeHcyKku0m8znY74nOu+m6LXkIt8r29pi6Xac0/ZGMwKZRUvKg/skamWPRoy9DAVd8TBQW1c91oYKmqDQRy0eWnD6X1djcKywJ7WlSQDejebJql0h+o=
29-
file_glob: true
30-
file: "$XCODE_BUILD_PATH/*.zip"
31-
skip_cleanup: true
32-
on:
33-
repo: lwouis/alt-tab-macos
34-
after_deploy: scripts/after_deploy.sh
1+
#branches:
2+
# only:
3+
# - master
4+
# - test-github-actions
5+
#os: osx
6+
#osx_image: xcode13.4
7+
#language: node_js
8+
#node_js:
9+
# - 16
10+
#addons:
11+
# ssh_known_hosts: github.com
12+
# homebrew:
13+
# packages:
14+
# - vitorgalvao/tiny-scripts/cask-repair
15+
# update: true
16+
#env:
17+
# global:
18+
# - IS_RELEASE=$(if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then echo true; fi)
19+
# - XCODE_BUILD_PATH="DerivedData/Build/Products/Release"
20+
# - VERSION_FILE="VERSION.txt"
21+
# - APP_NAME="$(awk -F ' = ' '/PRODUCT_NAME/ { print $2; }' < config/base.xcconfig)"
22+
# - BUILD_DIR="$TRAVIS_BUILD_DIR"
23+
#install: true # disable default install
24+
#script: scripts/print_env_vars.sh
25+
#script: scripts/print_env.sh && scripts/pre_build_checks.sh && scripts/ci_cd.sh
26+
#before_deploy: if [[ $TRAVIS_TEST_RESULT == 1 ]]; then echo "build failed; exiting to prevent deploy phases"; sleep 2; exit 1; fi
27+
#deploy:
28+
# provider: releases
29+
# token:
30+
# secure: wZUHfOs+JQ0ikNMJ8BnM+8fuoQdhgOEQpNd01ueZxe760GAAjSbq1icME8qaYJJMk1G6n14jo9ecEhzxF0XV8hSdy4WtikK7l5SXiOx5Efuh/tNscmHggGk235eLwQD9pglePZsP3xJUB1BHEj260rypkjnSx5kVOfLUeB1ASeg4+KdxZd2vXjwel+YQf+dYbNUYtwoWqjiLbqT1ao+0q04MPgD2c9jb+HnsA94LUGb44lPXqfUJ+xG2LxBpcDW/q1JhFXL/AmJb0dOOEVzzrBqfWysPukgPMONexZse4c3BBqkMI52ZuF3OoEVAffofmuGKiR5OoyU/hW17xi9jGeb79r+Xt4RdaJAgwcn7/7GtemYKUJp8jhLGsy9XZJShENX7UHTkP3L4iyOrd2Wz+ctZWAebyNReLt985/xTaplpDiQrPcKAuQNBa4sgWk5rIsf7Z0tcBfZau/fQl9Q4100xTbwC+GeAbL0IyXG3kVzQGsGllXHr/2JM1sj7rmKA7lmDlp7xiOBCPscn2YCT87U+F6VbYoNvnxne0igQOUwrvX4qa4XlYrUXDeHcyKku0m8znY74nOu+m6LXkIt8r29pi6Xac0/ZGMwKZRUvKg/skamWPRoy9DAVd8TBQW1c91oYKmqDQRy0eWnD6X1djcKywJ7WlSQDejebJql0h+o=
31+
# file_glob: true
32+
# file: "$XCODE_BUILD_PATH/*.zip"
33+
# skip_cleanup: true
34+
# on:
35+
# repo: lwouis/alt-tab-macos
36+
#after_deploy: scripts/after_deploy.sh

alt-tab-macos.xcodeproj/project.pbxproj

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@
289289
1C96189E451343DFB9F27C66 /* app_icons_align_thumbnails_center_light@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "app_icons_align_thumbnails_center_light@2x.jpg"; sourceTree = "<group>"; };
290290
1C9618B3872558FBDE74D073 /* install_swiftformat.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = install_swiftformat.js; sourceTree = "<group>"; };
291291
1C9618C8080211CBF882E4E0 /* thumbnails_hide_colored_circles_light@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "thumbnails_hide_colored_circles_light@2x.jpg"; sourceTree = "<group>"; };
292+
1C9619ABA703AADC5225C494 /* ci_cd.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.yaml; path = ci_cd.yml; sourceTree = "<group>"; };
292293
1C9619DEB8B7905DBF9A6030 /* titles_hide_tabs_as_windows_light@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "titles_hide_tabs_as_windows_light@2x.jpg"; sourceTree = "<group>"; };
293294
1C961A0A3EF637793B0F9B89 /* thumbnails_align_thumbnails_leading_light@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "thumbnails_align_thumbnails_leading_light@2x.jpg"; sourceTree = "<group>"; };
294295
1C961A9B3F8ABA1ECFDF7C9F /* app_icons_hide_preview_focused_window_light@2x.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "app_icons_hide_preview_focused_window_light@2x.jpg"; sourceTree = "<group>"; };
@@ -360,6 +361,7 @@
360361
BF0C864F182B6155A66D241D /* KeyRepeatTimer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyRepeatTimer.swift; sourceTree = "<group>"; };
361362
BF0C86C2BB70A8E05D2103CA /* cs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = cs; path = Localizable.strings; sourceTree = "<group>"; };
362363
BF0C86E06A44AC151FEA4903 /* sv */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = sv; path = InfoPlist.strings; sourceTree = "<group>"; };
364+
BF0C8703C7489A44BEC4BCED /* pre_build_checks.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = pre_build_checks.sh; sourceTree = "<group>"; };
363365
BF0C87320241EAE01E38EF53 /* .periphery.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.yaml; path = .periphery.yml; sourceTree = "<group>"; };
364366
BF0C87897C24638DDE4A9889 /* app-icons-style.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "app-icons-style.jpg"; sourceTree = "<group>"; };
365367
BF0C87B913292EE53EDE4220 /* menubar-1.svg */ = {isa = PBXFileReference; lastKnownFileType = file.svg; path = "menubar-1.svg"; sourceTree = "<group>"; };
@@ -398,6 +400,7 @@
398400
BF0C8B2EA9269BA0B79A525F /* sk */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = sk; path = Localizable.strings; sourceTree = "<group>"; };
399401
BF0C8BA452332236D972C60E /* ATShortcut.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ATShortcut.swift; sourceTree = "<group>"; };
400402
BF0C8BED805610C4F9C46A4A /* export_l10n_strings_to_poeditor.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = export_l10n_strings_to_poeditor.sh; sourceTree = "<group>"; };
403+
BF0C8C0FF1B21F5F7CE16B79 /* print_env.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = print_env.sh; sourceTree = "<group>"; };
401404
BF0C8C4E74DCA631A049492A /* preferences-policies.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "preferences-policies.jpg"; sourceTree = "<group>"; };
402405
BF0C8C4F77466FB59071A71F /* sr */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = sr; path = InfoPlist.strings; sourceTree = "<group>"; };
403406
BF0C8C5210ACA9FBFAE9C631 /* preferences-general.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "preferences-general.jpg"; sourceTree = "<group>"; };
@@ -577,7 +580,7 @@
577580
D04BAD40CE2D3A8AAC3819D0 /* .gitignore */ = {isa = PBXFileReference; lastKnownFileType = file.gitignore; path = .gitignore; sourceTree = "<group>"; };
578581
D04BAD60C97E609A759E721E /* PoliciesTab.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PoliciesTab.swift; sourceTree = "<group>"; };
579582
D04BAD65AA870A49D2F89DBC /* ensure_generated_files_are_up_to_date.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ensure_generated_files_are_up_to_date.sh; sourceTree = "<group>"; };
580-
D04BAD6700415D6F7C8B2BEE /* travis.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = travis.sh; sourceTree = "<group>"; };
583+
D04BAD6700415D6F7C8B2BEE /* ci_cd.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = ci_cd.sh; sourceTree = "<group>"; };
581584
D04BAD7008ED1D9CBC147A75 /* pull_request_template.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = pull_request_template.md; sourceTree = "<group>"; };
582585
D04BAD7D8F3CC2C36C8769C6 /* .travis.yml */ = {isa = PBXFileReference; lastKnownFileType = file.yml; path = .travis.yml; sourceTree = "<group>"; };
583586
D04BAD82F652C4ED5D8BF7AE /* 3 windows - 1 line - tall window.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "3 windows - 1 line - tall window.jpg"; sourceTree = "<group>"; };
@@ -682,6 +685,14 @@
682685
path = preferences;
683686
sourceTree = "<group>";
684687
};
688+
1C961B4542D84D5B6E937B15 /* workflows */ = {
689+
isa = PBXGroup;
690+
children = (
691+
1C9619ABA703AADC5225C494 /* ci_cd.yml */,
692+
);
693+
path = workflows;
694+
sourceTree = "<group>";
695+
};
685696
4807A6C423A9CD190052A53E /* Frameworks */ = {
686697
isa = PBXGroup;
687698
children = (
@@ -1185,6 +1196,7 @@
11851196
D04BAD7008ED1D9CBC147A75 /* pull_request_template.md */,
11861197
D04BA7A56A2009957C939159 /* ISSUE_TEMPLATE */,
11871198
BF0C89F6EA16DD7322626E20 /* FUNDING.yml */,
1199+
1C961B4542D84D5B6E937B15 /* workflows */,
11881200
);
11891201
path = .github;
11901202
sourceTree = "<group>";
@@ -1367,7 +1379,7 @@
13671379
D04BAE93A5854C501639C640 /* update_homebrew_cask.sh */,
13681380
D04BA0AAAE82C72855DBBA26 /* update_appcast.sh */,
13691381
D04BA123744B0C27E9F54B05 /* codesign_sparkle_embedded_apps.sh */,
1370-
D04BAD6700415D6F7C8B2BEE /* travis.sh */,
1382+
D04BAD6700415D6F7C8B2BEE /* ci_cd.sh */,
13711383
D04BA81B25C166EFB3223639 /* extract_l10n_strings.sh */,
13721384
D04BA4FB0047656BEA21F1BE /* codesign */,
13731385
D04BA19E22F2B73DB785E5DB /* subset_font.sh */,
@@ -1387,6 +1399,8 @@
13871399
1C9618B3872558FBDE74D073 /* install_swiftformat.js */,
13881400
1C961AD30050B3BAC2A8EDD4 /* swiftformat.js */,
13891401
BF0C8BED805610C4F9C46A4A /* export_l10n_strings_to_poeditor.sh */,
1402+
BF0C8C0FF1B21F5F7CE16B79 /* print_env.sh */,
1403+
BF0C8703C7489A44BEC4BCED /* pre_build_checks.sh */,
13901404
);
13911405
path = scripts;
13921406
sourceTree = "<group>";

scripts/travis.sh renamed to scripts/ci_cd.sh

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
#!/usr/bin/env bash
22

3-
set -exu
4-
5-
env | sort
6-
xcodebuild -version
7-
xcodebuild -workspace alt-tab-macos.xcworkspace -scheme Release -showBuildSettings | grep SWIFT_VERSION
8-
9-
npm ci
10-
11-
npx commitlint-travis
12-
scripts/ensure_generated_files_are_up_to_date.sh
3+
set -ex
134

145
if [ $IS_RELEASE ]; then
156
scripts/determine_version.sh
167
scripts/replace_environment_variables_in_app.sh
178
fi
189

1910
scripts/codesign/setup_ci_master.sh
11+
xcodebuild -version
12+
xcodebuild -workspace alt-tab-macos.xcworkspace -scheme Release -showBuildSettings | grep SWIFT_VERSION
2013
xcodebuild -workspace alt-tab-macos.xcworkspace -scheme Release -derivedDataPath DerivedData
21-
file "$TRAVIS_BUILD_DIR/$XCODE_BUILD_PATH/$APP_NAME.app/Contents/MacOS/$APP_NAME"
14+
file "$BUILD_DIR/$XCODE_BUILD_PATH/$APP_NAME.app/Contents/MacOS/$APP_NAME"
2215

2316
if [ $IS_RELEASE ]; then
2417
scripts/package_and_notarize_release.sh

scripts/codesign/setup_ci_master.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ certificateFile="codesign"
77
# Recreate the certificate from the secure environment variable
88
echo "$APPLE_P12_CERTIFICATE" | base64 --decode > $certificateFile.p12
99

10-
scripts/codesign/import_certificate_into_new_keychain.sh "$certificateFile" "$APPLE_P12_CERTIFICATE_PASSWORD"
10+
scripts/codesign/import_certificate_into_new_keychain.sh "$certificateFile" ""

scripts/ensure_generated_files_are_up_to_date.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
set -exu
1+
set -ex
22

3-
brew install jq
3+
if [ "$TRAVIS" = true ] ; then
4+
brew install jq
5+
fi
46
scripts/update_contributors.sh
57
#scripts/import_l10n_strings_from_poeditor.sh
68
scripts/extract_l10n_strings.sh

scripts/pre_build_checks.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
npm ci
6+
if [ "$TRAVIS" = true ] ; then
7+
npx commitlint-travis
8+
npx commitlint
9+
else
10+
npx commitlint --from "$GITHUB_EVENT_BEFORE" --to "$GITHUB_EVENT_AFTER" --verbose
11+
fi
12+
scripts/ensure_generated_files_are_up_to_date.sh

scripts/print_env.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
pwd
6+
env | sort
7+
jq --version

scripts/update_homebrew_cask.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
#!/usr/bin/env bash
22

3-
set -exu
3+
set -ex
4+
5+
brew update
6+
brew install vitorgalvao/tiny-scripts/cask-repair
47

58
version="$(cat $VERSION_FILE)"
69

7-
# add github ssh key
8-
echo "$GITHUB_SSH_KEY" | base64 --decode > github_ssh
9-
chmod 600 github_ssh
10-
ssh-add -K github_ssh
10+
if [ "$TRAVIS" = true ] ; then
11+
# add github ssh key
12+
echo "$GITHUB_SSH_KEY" | base64 --decode > github_ssh
13+
chmod 600 github_ssh
14+
ssh-add -K github_ssh
15+
fi
1116

1217
cask-repair --blind-submit --cask-version "$version" alt-tab

0 commit comments

Comments
 (0)