-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (92 loc) · 3.52 KB
/
release.yml
File metadata and controls
103 lines (92 loc) · 3.52 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: release (github-hosted ubuntu-latest)
on:
workflow_dispatch:
inputs:
version:
type: string
required: true
default: "0.0.0"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: create branch
run: |
BRANCH="feature/v${{ github.event.inputs.version }}"
echo "Creating branch: $BRANCH"
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git fetch origin
git checkout -b "$BRANCH" origin/main
git push origin "$BRANCH"
- name: update version (unity)
run: |
VERSION="${{ github.event.inputs.version }}"
echo "Updating package.json files to version $VERSION"
FILES=(
./bin/LocalPrefs.Core/package.json
./bin/LocalPrefs.Json/package.json
./bin/LocalPrefs.MessagePack/package.json
./src/LocalPrefs.Unity/Packages/jp.andantetribe.localprefs/package.json
)
for FILE in "${FILES[@]}"; do
echo "Updating $FILE"
jq --arg ver "$VERSION" '.version = $ver' "$FILE" > tmp.$$.json && mv tmp.$$.json "$FILE"
done
- name: update version (csproj)
run: |
VERSION="${{ github.event.inputs.version }}"
echo "Updating .csproj files to version $VERSION"
FILES=(
./src/LocalPrefs.Json/LocalPrefs.Json.csproj
./src/LocalPrefs.MessagePack/LocalPrefs.MessagePack.csproj
./src/LocalPrefs/LocalPrefs.csproj
)
for FILE in "${FILES[@]}"; do
echo "Updating $FILE"
sed -i -E "s|<Version>.*</Version>|<Version>${VERSION}</Version>|" "$FILE"
done
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- run: |
dotnet restore ./src/LocalPrefs/LocalPrefs.slnx
dotnet build ./src/LocalPrefs/LocalPrefs.slnx --configuration Release --no-restore
- name: commit and push
run: |
VERSION="${{ github.event.inputs.version }}"
git add \
./bin/LocalPrefs.Core/package.json \
./bin/LocalPrefs.Core/LocalPrefs.Core.dll \
./bin/LocalPrefs.Core/LocalPrefs.Core.xml \
./bin/LocalPrefs.Json/package.json \
./bin/LocalPrefs.Json/LocalPrefs.Json.dll \
./bin/LocalPrefs.Json/LocalPrefs.Json.xml \
./bin/LocalPrefs.MessagePack/package.json \
./bin/LocalPrefs.MessagePack/LocalPrefs.MessagePack.dll \
./bin/LocalPrefs.MessagePack/LocalPrefs.MessagePack.xml \
./src/LocalPrefs.Unity/Packages/jp.andantetribe.localprefs/package.json \
./src/LocalPrefs.Json/LocalPrefs.Json.csproj \
./src/LocalPrefs.MessagePack/LocalPrefs.MessagePack.csproj \
./src/LocalPrefs/LocalPrefs.csproj
git commit -m "chore: bump version to ${VERSION}"
git push origin HEAD
- name: create pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
run: |
VERSION="${{ github.event.inputs.version }}"
BRANCH="feature/v$VERSION"
gh pr create \
--base main \
--head "$BRANCH" \
--title "chore: bump version to $VERSION" \
--fill \
--assignee "${{ github.actor }}"