bump version in correct dir #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
repository: getargv/getargv | |
path: getargv | |
token: ${{ secrets.GH_PAT }} | |
- name: Build libgetargv | |
run: make install_dylib | |
working-directory: getargv | |
- uses: actions/checkout@v4 | |
with: | |
path: getargv-swift | |
- uses: swift-actions/setup-swift@v1 | |
with: | |
swift-version: 5.9 | |
- 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@v3 | |
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: echo "new_version=$(git tag | sort -V | tail -1 | awk -F. 'BEGIN { OFS = "." } {$NF+=1; print $0}')" >> $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@v1 | |
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 }} |