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

Commit 49abcbe

Browse files
committed
chore(release): v1.0
0 parents  commit 49abcbe

File tree

5 files changed

+538
-0
lines changed

5 files changed

+538
-0
lines changed

.github/workflows/tests.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright © 2025 Cassidy Spring (Bee).
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this
4+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
6+
name: tests
7+
8+
on:
9+
workflow_dispatch:
10+
push:
11+
branches: [main]
12+
pull_request:
13+
branches: [main]
14+
15+
jobs:
16+
test:
17+
strategy:
18+
matrix:
19+
os: [macos-latest, ubuntu-latest]
20+
swift-version: ['latest', '6.1']
21+
runs-on: ${{ matrix.os }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: ./
25+
with:
26+
swift-version: ${{ matrix.swift-version }}
27+
- name: test - latest
28+
if: ${{ matrix.swift-version == 'latest' }}
29+
shell: bash
30+
run: swift --version | grep -q 'Swift version'
31+
- name: test - version
32+
if: ${{ matrix.swift-version != 'latest' }}
33+
shell: bash
34+
run: swift --version | grep -q 'Swift version ${{ matrix.swift-version }}'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

action.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Copyright © 2025 Cassidy Spring (Bee).
2+
# This Source Code Form is subject to the terms of the Mozilla Public
3+
# License, v. 2.0. If a copy of the MPL was not distributed with this
4+
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
5+
6+
name: Swiftly Swift
7+
author: Cassidy Spring (Bee)
8+
description: Installs Swiftly and a Swift Toolchain.
9+
branding:
10+
icon: command
11+
color: orange
12+
13+
inputs:
14+
swift-version:
15+
description: Swift Toolchain version that Swiftly will install and use, defaults to latest.
16+
required: true
17+
default: latest
18+
19+
runs:
20+
using: composite
21+
steps:
22+
- name: Check Runner OS
23+
if: ${{ runner.os != 'macOS' && runner.os != 'Linux' }}
24+
shell: bash
25+
run: |
26+
echo "::error::Only supports macOS and linux"
27+
exit 1
28+
29+
- name: Get Date
30+
id: date
31+
shell: bash
32+
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
33+
34+
- name: Restore Swiftly - macOS
35+
if: ${{ runner.os == 'macOS' }}
36+
uses: actions/cache/restore@v4
37+
id: restore-swiftly-cache-macos
38+
with:
39+
path: swiftly.pkg
40+
key: swiftly-${{ runner.os }}-${{ runner.arch }}-${{ steps.date.outputs.date }}
41+
42+
- name: Download Swiftly - macOS
43+
if: ${{ runner.os == 'macOS' && steps.restore-swiftly-cache-macos.outputs.cache-hit != 'true' }}
44+
shell: bash
45+
run: |
46+
curl -O https://download.swift.org/swiftly/darwin/swiftly.pkg
47+
pkgutil --check-signature swiftly.pkg
48+
49+
- name: Cache Swiftly - macOS
50+
if: ${{ runner.os == 'macOS' && steps.restore-swiftly-cache-macos.outputs.cache-hit != 'true' }}
51+
uses: actions/cache/save@v4
52+
id: save-swiftly-cache-macos
53+
with:
54+
path: swiftly.pkg
55+
key: swiftly-${{ runner.os }}-${{ runner.arch }}-${{ steps.date.outputs.date }}
56+
57+
- name: Install Swiftly - macOS
58+
if: ${{ runner.os == 'macOS' }}
59+
shell: bash
60+
run: |
61+
installer -pkg swiftly.pkg -target CurrentUserHomeDirectory
62+
~/.swiftly/bin/swiftly init --verbose --assume-yes --skip-install
63+
. "${SWIFTLY_HOME_DIR:-$HOME/.swiftly}/env.sh"
64+
hash -r
65+
echo "PATH=$PATH" >> $GITHUB_ENV
66+
67+
- name: Restore Swiftly - Linux
68+
if: ${{ runner.os == 'Linux' }}
69+
uses: actions/cache/restore@v4
70+
id: restore-swiftly-cache-linux
71+
with:
72+
path: swiftly.tar.gz
73+
key: swiftly-${{ runner.os }}-${{ runner.arch }}-${{ steps.date.outputs.date }}
74+
75+
- name: Download Swiftly - Linux
76+
if: ${{ runner.os == 'Linux' && steps.restore-swiftly-cache-linux.outputs.cache-hit != 'true' }}
77+
shell: bash
78+
run: |
79+
curl -o swiftly.tar.gz https://download.swift.org/swiftly/linux/swiftly-$(uname -m).tar.gz
80+
81+
- name: Cache Swiftly - Linux
82+
if: ${{ runner.os == 'Linux' && steps.restore-swiftly-cache-linux.outputs.cache-hit != 'true' }}
83+
uses: actions/cache/save@v4
84+
id: save-swiftly-cache-linux
85+
with:
86+
path: swiftly.tar.gz
87+
key: swiftly-${{ runner.os }}-${{ runner.arch }}-${{ steps.date.outputs.date }}
88+
89+
- name: Install Swiftly - Linux
90+
if: ${{ runner.os == 'Linux' }}
91+
shell: bash
92+
run: |
93+
tar -zxf swiftly.tar.gz
94+
./swiftly init --verbose --assume-yes --skip-install
95+
. "${SWIFTLY_HOME_DIR:-$HOME/.local/share/swiftly}/env.sh"
96+
hash -r
97+
echo "PATH=$PATH" >> $GITHUB_ENV
98+
99+
# NOTE: It feels bad to have sudo statements here but I could not get the post install to work
100+
# without both of them in place on linux. Neither (and chmod at all) is required on macOS.
101+
# So this would be nice to dig into more but definitely done for now.
102+
- name: Install Swift Toolchain
103+
shell: bash
104+
run: |
105+
swiftly install --use ${{ inputs.swift-version }} --post-install-file=post-install.sh
106+
if [ -f post-install.sh ]; then
107+
sudo chmod u+x post-install.sh
108+
sudo ./post-install.sh
109+
fi

0 commit comments

Comments
 (0)