-
Notifications
You must be signed in to change notification settings - Fork 16
71 lines (63 loc) · 2.7 KB
/
version.yaml
File metadata and controls
71 lines (63 loc) · 2.7 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
---
# This workflow is triggered manually to increment version numbers and open a
# release PR. When that PR is merged, a release is created (see `release.yaml`).
on:
workflow_dispatch:
inputs:
bump_type:
description: Version bump type
required: true
type: choice
options:
- patch
- minor
- major
default: patch
name: Update versions and create release PR
jobs:
version:
name: Bump version and create release PR
runs-on: ubuntu-latest
environment: version-bump
steps:
# See: https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#authenticating-with-github-app-generated-tokens
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: generate_token
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Fetch all history/tags (needed to compute versions)
fetch-depth: 0
- uses: cachix/install-nix-action@7be5dee1421f63d07e71ce6e0a9f8a4b07c2a487 # v31.6.1
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: |
extra-experimental-features = nix-command flakes
accept-flake-config = true
- name: Get old version number
id: old_cargo_metadata
run: echo "version=$(nix run .#get-crate-version)" >> "$GITHUB_OUTPUT"
- name: Increment `Cargo.toml` version
run: nix run .#make-release-commit -- ${{ inputs.bump_type }}
- name: Get new version number
id: new_cargo_metadata
run: echo "version=$(nix run .#get-crate-version)" >> "$GITHUB_OUTPUT"
- name: Create release PR
id: release_pr
uses: peter-evans/create-pull-request@4e1beaa7521e8b457b572c090b25bd3db56bf1c5 # v5.0.3
with:
# PRs created with the default `secrets.GITHUB_TOKEN` won't
# trigger `pull_request` workflows, so regular CI won't run either.
# See: https://github.com/orgs/community/discussions/65321
token: ${{ steps.generate_token.outputs.token }}
branch: release/${{ steps.new_cargo_metadata.outputs.version }}
delete-branch: true
base: main
title: Release version ${{ steps.new_cargo_metadata.outputs.version }}
body: |
Update version to ${{ steps.new_cargo_metadata.outputs.version }} with [cargo-release](https://github.com/crate-ci/cargo-release).
Merge this PR to build and publish a new release.
labels: release