-
Notifications
You must be signed in to change notification settings - Fork 55
90 lines (87 loc) · 2.9 KB
/
release_bump_versions.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
name: (Manual Release) - Bumps all packages + PR
on:
workflow_dispatch:
inputs:
base:
description: 'Name of branch to open PR against'
type: 'string'
default: 'master'
version:
description: 'Select level for version increment'
type: choice
required: true
default: patch
options:
- major
- minor
- patch
permissions:
contents: write
pull-requests: write
jobs:
bump-packages:
name: Build & Bump packages
runs-on: '${{ matrix.os }}'
strategy:
matrix:
include:
- os: ubuntu-latest
steps:
- name: "Check if user has write access"
uses: "lannonbr/[email protected]"
with:
permission: "write"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- uses: actions/checkout@v3
- run: |
git config --global user.email "[email protected]"
git config --global user.name "Haaroon"
- name: "Set up Rust toolchain"
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.73.0
override: true
components: rustfmt, clippy
- name: "Install cargo release"
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-release --force
- name: "Bump version with cargo release"
uses: actions-rs/cargo@v1
with:
command: release
args: --execute --no-confirm --no-publish --no-push --no-tag ${{ inputs.version }}
- name: "Fetch version of crate package and save to env"
id: set_version
run: |
echo CRATE_VERSION=$(cat Cargo.toml | grep version | head -n1 | cut -d '"' -f2) >> $GITHUB_ENV
echo "Crate version is $CRATE_VERSION"
- name: "Make a PR to bump version"
uses: peter-evans/create-pull-request@v5
with:
base: ${{ inputs.base }}
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: ${{ env.CRATE_VERSION }}
commit-message: "Release v${{ env.CRATE_VERSION }}"
title: "Release v${{ env.CRATE_VERSION }}"
body: |
Release v${{ env.CRATE_VERSION }}
- [x] Publish to crates.io
- [x] Publish to PyPi
- [x] Publish to Github as release
- Auto-generated by [create-pull-request] triggered by release action [1]
[1]: https://github.com/peter-evans/create-pull-request