forked from ml-explore/mlx-swift
-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (54 loc) · 2.01 KB
/
auto_release.yml
File metadata and controls
61 lines (54 loc) · 2.01 KB
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
56
57
58
59
60
61
name: Auto Release Pipeline
on:
push:
branches:
- main
permissions:
contents: write
jobs:
tag-and-release:
name: Create SemVer Tag and Release
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Essential for retrieving all tags to calculate the next semver bump
- name: Calculate release version (b<commit_count>)
id: tag_version
run: |
COMMIT_COUNT=$(git rev-list --count HEAD)
TAG_NAME="b${COMMIT_COUNT}"
echo "Calculated tag: $TAG_NAME"
echo "new_tag=$TAG_NAME" >> $GITHUB_OUTPUT
# Create and push the tag manually
git tag $TAG_NAME
git push origin $TAG_NAME
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: "Automated release based on commit count ${{ steps.tag_version.outputs.new_tag }}"
generate_release_notes: true
- name: Trigger SwiftLM Dependency Bump
uses: actions/github-script@v6
env:
PR_TOKEN: ${{ secrets.SWIFTLM_PR_TOKEN || secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
with:
github-token: ${{ env.PR_TOKEN }}
script: |
try {
await github.rest.repos.createDispatchEvent({
owner: 'SharpAI',
repo: 'SwiftLM',
event_type: 'dependency_bump',
client_payload: {
source_repo: context.repo.repo,
new_tag: '${{ steps.tag_version.outputs.new_tag }}'
}
});
console.log("Successfully dispatched dependency_bump event to SharpAI/SwiftLM");
} catch (error) {
console.log("Dispatch failed. Ensure SWIFTLM_PR_TOKEN is set in repository secrets with repo scoping.", error);
}