-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (65 loc) · 2 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (65 loc) · 2 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
62
63
64
65
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g., 1.2.3)"
required: true
type: string
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: dev
- name: Validate version format
run: |
if ! [[ "${{ inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format. Use semver: x.y.z"
exit 1
fi
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Update Cargo.toml
run: |
sed -i 's/^version = .*/version = "${{ inputs.version }}"/' Cargo.toml
- name: Update Cargo.lock
run: |
cargo update --workspace
- name: Commit version update
run: |
git add Cargo.toml Cargo.lock
git commit -m "chore(release): v${{ inputs.version }}"
- name: Push to dev
run: git push origin dev
- name: Checkout main
run: git checkout main && git pull origin main
- name: Merge dev into main
run: |
git merge --no-ff dev -m "chore(release): v${{ inputs.version }}"
- name: Push to main
run: git push origin main
- name: Sync dev with main
run: |
git checkout dev
git merge main
git push origin dev
- name: Create tag
run: |
git tag -a "v${{ inputs.version }}" -m "Release version ${{ inputs.version }}"
git push origin "v${{ inputs.version }}"
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ inputs.version }}
release_name: Release v${{ inputs.version }}
draft: false
prerelease: false