Skip to content

Commit 5754e07

Browse files
authored
Merge pull request #1 from YOCKOW/premaster
Publish v1.0.0
2 parents 75a80af + 4a62b20 commit 5754e07

File tree

386 files changed

+75231
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

386 files changed

+75231
-0
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
on: [push, pull_request]
2+
jobs:
3+
test:
4+
strategy:
5+
matrix:
6+
os: [ubuntu-latest, macOS-latest]
7+
runs-on: ${{ matrix.os }}
8+
name: Test to install Swift.
9+
steps:
10+
- name: Install Swift.
11+
uses: YOCKOW/Action-setup-swift@development
12+
with:
13+
swift-version: '5.0.3'
14+
- name: View Swift Version
15+
run: swift --version

.gitignore

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

LICENSE.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
The MIT License (MIT)
2+
Copyright (c) 2019 YOCKOW
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
5+
and associated documentation files (the "Software"), to deal in the Software without restriction,
6+
including without limitation the rights to use, copy, modify, merge, publish, distribute,
7+
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all copies or substantial
11+
portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
14+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
16+
OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
17+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Action: setup-swift
2+
3+
This action sets up a Swift environment using [swiftenv](https://github.com/kylef/swiftenv).
4+
5+
6+
# Usage
7+
8+
See [action.yml](action.yml)
9+
10+
```yaml
11+
steps:
12+
- uses: actions/checkout@master
13+
- uses: YOCKOW/Action-setup-swift@master
14+
with:
15+
swift-version: '5.0.3' # This value is passed to swiftenv without modification.
16+
- run: swift --version
17+
```
18+
19+
20+
# License
21+
MIT License.
22+
See "LICENSE.txt" for more information.
23+

action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'Swift Setup'
2+
description: 'Setting Swift up.'
3+
inputs:
4+
swift-version:
5+
description: 'The version of Swift.'
6+
required: true
7+
runs:
8+
using: 'node12'
9+
main: 'main.js'

main.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const core = require('@actions/core');
2+
const github = require('@actions/github');
3+
const exec = require('@actions/exec')
4+
5+
const swiftVersion = core.getInput('swift-version');
6+
const swiftenvDirectory = '$HOME/.swiftenv'
7+
const swiftenvBinDirectory = swiftenvDirectory + '/bin'
8+
const swiftenvPath = swiftenvBinDirectory + '/swiftenv'
9+
10+
async function main() {
11+
core.startGroup('Download swiftenv...')
12+
await exec.exec('git', ['clone', 'https://github.com/kylef/swiftenv.git', swiftenvDirectory])
13+
core.addPath(swiftenvBinDirectory)
14+
core.endGroup()
15+
16+
core.startGroup('Download swift via swiftenv...')
17+
let swiftPath = ''
18+
await exec.exec(swiftenvPath, ['install', swiftVersion])
19+
await exec.exec(swiftenvPath, ['which', 'swift'], {
20+
listeners: {
21+
stdout: data => { swiftPath = data.toString().trim() }
22+
}
23+
})
24+
let swiftBinDirectory= swiftPath.replace(/\/swift$/, '')
25+
core.addPath(swiftBinDirectory)
26+
core.endGroup()
27+
}
28+
29+
main()

node_modules/.bin/semver

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/.bin/which

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/README.md

Lines changed: 97 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/command.d.ts

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)