-
Notifications
You must be signed in to change notification settings - Fork 2
152 lines (141 loc) · 7.34 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Release
on:
workflow_dispatch:
inputs:
project:
description: 'Select Project'
required: true
type: choice
options:
- BeMatch
- FlyCam
version:
description: 'CFBundleShortVersionString'
required: true
jobs:
bematch:
runs-on: macOS-latest
if: ${{ inputs.project == 'BeMatch' }}
steps:
- uses: actions/checkout@v4
- name: Current Version
id: current-version
run: echo "CURRENT_VERSION=$(defaults read $(pwd)/App/BeMatch/Multiplatform/Staging/Info CFBundleShortVersionString)" >> $GITHUB_OUTPUT
- run: |
sed -i '' "s/${{ steps.current-version.outputs.CURRENT_VERSION }}/${{ github.event.inputs.version }}/g" App/BeMatch/Multiplatform/Staging/Info.plist
sed -i '' "s/${{ steps.current-version.outputs.CURRENT_VERSION }}/${{ github.event.inputs.version }}/g" App/BeMatch/Multiplatform/Production/Info.plist
- continue-on-error: true
uses: peter-evans/create-pull-request@v5
id: create-pr
with:
delete-branch: true
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
branch-suffix: short-commit-hash
commit-message: "Bump BeMatch from ${{ steps.current-version.outputs.CURRENT_VERSION }} to ${{ github.event.inputs.version }}"
title: "Bump BeMatch from ${{ steps.current-version.outputs.CURRENT_VERSION }} to ${{ github.event.inputs.version }}"
- continue-on-error: true
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ steps.create-pr.outputs.pull-request-url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- continue-on-error: true
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ steps.create-pr.outputs.pull-request-url }}
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
flycam:
runs-on: macOS-latest
if: ${{ inputs.project == 'FlyCam' }}
steps:
- uses: actions/checkout@v4
- name: Current Version
id: current-version
run: echo "CURRENT_VERSION=$(defaults read $(pwd)/App/FlyCam/Multiplatform/Staging/Info CFBundleShortVersionString)" >> $GITHUB_OUTPUT
- run: |
sed -i '' "s/${{ steps.current-version.outputs.CURRENT_VERSION }}/${{ github.event.inputs.version }}/g" App/FlyCam/Multiplatform/Staging/Info.plist
sed -i '' "s/${{ steps.current-version.outputs.CURRENT_VERSION }}/${{ github.event.inputs.version }}/g" App/FlyCam/Multiplatform/Production/Info.plist
- continue-on-error: true
uses: peter-evans/create-pull-request@v5
id: create-pr
with:
delete-branch: true
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
branch-suffix: short-commit-hash
commit-message: "Bump FlyCam from ${{ steps.current-version.outputs.CURRENT_VERSION }} to ${{ github.event.inputs.version }}"
title: "Bump FlyCam from ${{ steps.current-version.outputs.CURRENT_VERSION }} to ${{ github.event.inputs.version }}"
- continue-on-error: true
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{ steps.create-pr.outputs.pull-request-url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- continue-on-error: true
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ steps.create-pr.outputs.pull-request-url }}
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
create-release-bematch:
runs-on: ubuntu-latest
needs: bematch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TZ: 'Asia/Tokyo'
steps:
- uses: actions/checkout@v4
- name: Get previous tag
id: pre_tag
run: |
echo "::set-output name=pre_tag::$(curl -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)"
- name: Generate release tag
id: release_tag
run: |
pre_release_date=$(echo ${{ steps.pre_tag.outputs.pre_tag }} | awk -F'-' '{print $1}')
pre_release_count=$(echo ${{ steps.pre_tag.outputs.pre_tag }} | awk -F'-' '{print $2}')
if [[ ! $pre_release_date = ${{ github.event.inputs.version }} ]]; then
echo "init count"
pre_release_count=0
fi
echo "::set-output name=release_tag::BeMatch-${{ github.event.inputs.version }}"
- name: Generate release note
id: release_note
run: |
echo "::set-output name=release_note::$(curl -X POST -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/generate-notes -d '{"tag_name":"${{ steps.release_tag.outputs.release_tag }}", "previous_tag_name":"${{ steps.pre_tag.outputs.pre_tag }}"}' | jq .body | sed 's/"//g')"
- name: Create Release
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d "{ \"tag_name\": \"${{ steps.release_tag.outputs.release_tag }}\", \"name\": \"${{ steps.release_tag.outputs.release_tag }}\", \"body\": \"${{ steps.release_note.outputs.release_note }}\"}" \
https://api.github.com/repos/${{ github.repository }}/releases
create-release-flycam:
runs-on: ubuntu-latest
needs: flycam
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TZ: 'Asia/Tokyo'
steps:
- uses: actions/checkout@v4
- name: Get previous tag
id: pre_tag
run: |
echo "::set-output name=pre_tag::$(curl -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)"
- name: Generate release tag
id: release_tag
run: |
pre_release_date=$(echo ${{ steps.pre_tag.outputs.pre_tag }} | awk -F'-' '{print $1}')
pre_release_count=$(echo ${{ steps.pre_tag.outputs.pre_tag }} | awk -F'-' '{print $2}')
if [[ ! $pre_release_date = ${{ github.event.inputs.version }} ]]; then
echo "init count"
pre_release_count=0
fi
echo "::set-output name=release_tag::FlyCam-${{ github.event.inputs.version }}"
- name: Generate release note
id: release_note
run: |
echo "::set-output name=release_note::$(curl -X POST -H 'Accept: application/vnd.github.v3+json' -H 'Authorization: token ${{ secrets.GITHUB_TOKEN }}' https://api.github.com/repos/${{ github.repository }}/releases/generate-notes -d '{"tag_name":"${{ steps.release_tag.outputs.release_tag }}", "previous_tag_name":"${{ steps.pre_tag.outputs.pre_tag }}"}' | jq .body | sed 's/"//g')"
- name: Create Release
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-d "{ \"tag_name\": \"${{ steps.release_tag.outputs.release_tag }}\", \"name\": \"${{ steps.release_tag.outputs.release_tag }}\", \"body\": \"${{ steps.release_note.outputs.release_note }}\"}" \
https://api.github.com/repos/${{ github.repository }}/releases