Skip to content

Commit

Permalink
automate release
Browse files Browse the repository at this point in the history
  • Loading branch information
CamJN committed Jan 14, 2024
1 parent b34c781 commit 18d67f7
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ name: Swift
on:
push:
branches: [ "main" ]
tags: [ '*' ]
pull_request:
branches: [ "main" ]

jobs:
build:
if: ${{ github.ref_type != 'tag' }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -46,16 +44,17 @@ jobs:
name: docs
path: getargv-swift/.build/plugins/Swift-DocC/outputs/SwiftGetargv.doccarchive.tar.gz
if-no-files-found: error

release:
if: ${{ github.ref_type == 'tag' }}
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: pkg
- 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
- 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: pkg/docs
name: ${{ github.ref_name }}
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 }}

0 comments on commit 18d67f7

Please sign in to comment.