-
Notifications
You must be signed in to change notification settings - Fork 126
62 lines (58 loc) · 1.96 KB
/
draft-release.yaml
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
name: "Draft new release"
on:
workflow_dispatch:
inputs:
new-version:
type: choice
description: "Which version you'd like to release?"
options:
- major (_.X.X)
- minor (X._.X)
- patch (X.X._)
- rc (X.X.X-rc)
- release (removes rc)
required: true
jobs:
draft-new-release:
name: "Draft a new release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: Swatinem/rust-cache@v2
- name: Install cargo-edit
run: cargo install cargo-edit
- name: Extracting version from input
run: |
VERSION=$(echo "${{github.event.inputs.new-version}}" | sed 's/ (.*)$//')
echo "VER=$VERSION" >> $GITHUB_ENV
- name: Bump new version in TOML files
run: |
OLD_VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "OLD=$OLD_VERSION" >> $GITHUB_ENV
cargo set-version --workspace --bump $VER
NEW_VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "NEW=$NEW_VERSION" >> $GITHUB_ENV
- name: Create release branch
run: |
git checkout -b release/$NEW
- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email [email protected]
- name: Updating Changelog and Dockerfile
run: .github/scripts/Bump.sh $OLD $NEW
- run: cargo check
- name: Commit changelog and manifest files
id: make-commit
run: |
git commit -sa -m "Prepare release $NEW"
echo "name=commit::$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Push new branch
run: git push origin release/$NEW
- name: Create pull request
run: |
gh pr create -B main --title "Release-v$NEW" --body "Yay release" --label "Release"
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}