Skip to content

Update versioning during build #8

Update versioning during build

Update versioning during build #8

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history so we can get all commits between tags
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest'
- name: Extract Version from Tag
run: echo "APP_VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
- name: Set Version Number
run: |
agvtool new-marketing-version ${{ env.APP_VERSION }}
agvtool new-version -all ${{ github.run_number }}
- name: Build App
run: xcodebuild -project IPMenuBar.xcodeproj -scheme "IPMenuBar - Release" -configuration Release clean build -derivedDataPath './build' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO
- name: Package App
run: |
FILE_NAME="IPMenuBar-${GITHUB_REF_NAME}.tar.gz"
echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
tar -czvf $FILE_NAME -C ./build/Build/Products/Release IPMenuBar.app
- name: Get Previous Tag
id: prev_tag
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: Get Commit Messages
id: get_commits
run: |
commits=$(git log ${{ steps.prev_tag.outputs.tag }}..HEAD --oneline)
echo "::set-output name=commits::${commits}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
body: ${{ steps.get_commits.outputs.commits }}
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.FILE_NAME }}
asset_name: ${{ env.FILE_NAME }}
asset_content_type: application/gzip