-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (66 loc) · 2.38 KB
/
swift.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
name: Swift
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: macos-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
repository: getargv/getargv
path: getargv
token: ${{ secrets.GH_PAT }}
- name: Build libgetargv
run: make dylib
working-directory: getargv
- name: Install libgetargv
run: sudo make install_dylib
working-directory: getargv
- uses: actions/checkout@v4
with:
path: getargv-swift
fetch-tags: true
fetch-depth: 0 # until https://github.com/actions/checkout/issues/1471 fixed
- uses: swift-actions/setup-swift@v2
with:
swift-version: '6.0'
# https://www.swift.org/download/
- name: Build
run: swift build -v
working-directory: getargv-swift
- name: Run tests
run: swift test -v
working-directory: getargv-swift
- name: Build docs
run: |
swift package generate-documentation
tar -cf .build/plugins/Swift-DocC/outputs/SwiftGetargv.doccarchive.tar .build/plugins/Swift-DocC/outputs/SwiftGetargv.doccarchive
gzip -9 .build/plugins/Swift-DocC/outputs/SwiftGetargv.doccarchive.tar
working-directory: getargv-swift
- uses: actions/upload-artifact@v4
with:
name: docs
path: getargv-swift/.build/plugins/Swift-DocC/outputs/SwiftGetargv.doccarchive.tar.gz
if-no-files-found: error
- name: Bump Version
id: bump_version
run: git tag | sort -V | tail -1 | awk -F. 'BEGIN { OFS = "." } {$NF+=1; print $0}' | xargs -I {} echo "new_version={}" >> $GITHUB_OUTPUT
working-directory: getargv-swift
- name: create && push tag
run: |
git tag '${{ steps.bump_version.outputs.new_version }}'
git push origin tag '${{ steps.bump_version.outputs.new_version }}'
git push origin HEAD:main
working-directory: getargv-swift
- uses: softprops/action-gh-release@v2
with:
files: getargv-swift/.build/plugins/Swift-DocC/outputs/SwiftGetargv.doccarchive.tar.gz
name: ${{ steps.bump_version.outputs.new_version }}
tag_name: ${{ steps.bump_version.outputs.new_version }}