-
Notifications
You must be signed in to change notification settings - Fork 24
55 lines (46 loc) · 1.58 KB
/
release.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
name: Build and release a new version
on:
push:
branches: [ "main" ]
paths: [ ".version" ]
workflow_dispatch:
jobs:
build:
uses: ./.github/workflows/build.yml
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: opencv2.xcframework.zip
- name: Get version
id: get_version
run: |
VERSION=$(cat .version)
if git rev-parse -q --verify "refs/tags/${VERSION}" >/dev/null; then
PATCH=$(git rev-list --count "refs/tags/${VERSION}..HEAD")
VERSION="${VERSION}+${PATCH}"
fi
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
- name: Update Package.swift
run: |
sed -i "s/let version = \".*\"/let version = \"${{ steps.get_version.outputs.VERSION }}\"/" Package.swift
sed -i "s/let checksum = \".*\"/let checksum = \"$(shasum -a 256 opencv2.xcframework.zip | cut -d ' ' -f 1)\"/" Package.swift
- name: Commit and push
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "GitHub Actions"
git add Package.swift
git commit -m "Update Package.swift"
git push
- name: Release
uses: softprops/action-gh-release@v1
with:
files: opencv2.xcframework.zip
tag_name: ${{ steps.get_version.outputs.VERSION }}