Skip to content

Build and release a new version #1

Build and release a new version

Build and release a new version #1

Workflow file for this run

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 }}