-
Notifications
You must be signed in to change notification settings - Fork 8
84 lines (81 loc) · 2.79 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
name: Create a GitHub Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
component:
description: 'Component to release'
required: true
type: choice
default: maa-cli
options:
- maa-cli
- maa-run
- maa-sys
commit:
description: 'Commit to release'
required: false
type: string
default: main
jobs:
release-manual:
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch'
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.commit }}
- name: Get name and version
id: vars
run: |
component=${{ github.event.inputs.component }}
tag_name=$(echo $component | sed -e 's/-/_/g')
version=$(yq -oy ".package.version" $component/Cargo.toml)
echo "name=$component $version" >> $GITHUB_OUTPUT
echo "tag_name=$tag_name-v$version" >> $GITHUB_OUTPUT
- name: Create Tag
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git tag ${{ steps.vars.outputs.tag_name }} ${{ github.event.inputs.commit }}
git push origin ${{ steps.vars.outputs.tag_name }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.vars.outputs.name }}
tag_name: ${{ steps.vars.outputs.tag_name }}
generate_release_notes: true
release-auto:
runs-on: ubuntu-latest
if: github.event_name == 'push' &&
contains(github.event.head_commit.message, '[release ')
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get name and version
id: vars
run: |
component=$(echo ${{ github.event.head_commit.message }} | sed -e 's/.*\[release \(.*\)\].*/\1/')
tag_name=$(echo $component | sed -e 's/-/_/g')
version=$(yq -oy ".package.version" $component/Cargo.toml)
echo "name=$component $version" >> $GITHUB_OUTPUT
echo "tag_name=$tag_name-v$version" >> $GITHUB_OUTPUT
- name: Create Tag
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git tag ${{ steps.vars.outputs.tag_name }}
git push origin ${{ steps.vars.outputs.tag_name }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: ${{ steps.vars.outputs.name }}
tag_name: ${{ steps.vars.outputs.tag_name }}
generate_release_notes: true