-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (35 loc) · 1.48 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
on:
workflow_dispatch:
inputs:
version:
description: "The version to release"
required: true
name: Release
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
name: Generate Github release and tag
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Write version
run: |
sed -i -E 's/^version = .*/version = "${{ github.event.inputs.version }}"/g' Cargo.toml
sed -i -E "$(( 1 + $(grep --line-number 'template-cli' Cargo.lock | cut -f1 -d:) ))"'s/^version = .*/version = "${{ github.event.inputs.version }}"/g' Cargo.lock
sed -i -E 's/r#"template-cli .*/r#"template-cli ${{ github.event.inputs.version }}/g' tests/integration_tests.rs
- name: Commit new version
run: |
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git add Cargo.toml Cargo.lock tests/integration_tests.rs
git commit --message "Version ${{ github.event.inputs.version }}"
git push
git tag --annotate --message 'Version ${{ github.event.inputs.version }}' "v${{ github.event.inputs.version }}"
git push origin "v${{ github.event.inputs.version }}"
- name: Trigger publish
run: gh workflow run publish.yml --ref "refs/tags/v${{ github.event.inputs.version }}"
env:
GH_TOKEN: ${{ github.token }}