Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic version number on GitHub release #507

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/createRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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: Create release

on:
release:
types: [created]

jobs:
release:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Get the tag version
id: tag_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Update version
run: sh Scripts/updateVersion.sh $GITHUB_TOKEN ${{ steps.tag_version.outputs.VERSION }}
10 changes: 10 additions & 0 deletions Scripts/updateVersion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# This script expects two inputs
# $1 - The github token for opentelemetry-swift
# $2 - the git tag

#Update version number
sed -E -i '' 's/public static let OTEL_SWIFT_SDK_VERSION = ".+"/public static let OTEL_SWIFT_SDK_VERSION = "'$2\"/ ./Sources/OpenTelemetrySdk/Version.swift
git commit -m "Updated version number to $2"
git tag -f $2
git push -f --tags origin HEAD:main
2 changes: 1 addition & 1 deletion Sources/OpenTelemetrySdk/Version.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
import Foundation

extension Resource {
public static let OTEL_SWIFT_SDK_VERSION : String = "1.8.0"
public static let OTEL_SWIFT_SDK_VERSION = "1.8.0"
}
Loading