forked from atsamd-rs/atsamd
-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (125 loc) · 4.45 KB
/
bump-crates.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Bump crate versions
on:
workflow_dispatch:
inputs:
pac_bump:
description: 'PAC version bump (none/patch/minor/major)'
required: true
default: 'none'
sync_hal:
description: 'Update PAC dep string in HAL crate (yes/no)'
required: true
default: 'yes'
hal_bump:
description: 'HAL version bump (none/patch/minor/major)'
required: true
default: 'none'
sync_bsp:
description: 'Update HAL dep string in T1 BSP crates (yes/no)'
required: true
default: 'yes'
bsp_bump:
description: 'T1 BSP version bump (none/patch/minor/major)'
required: true
default: 'none'
jobs:
bump-versions:
runs-on: ubuntu-latest
steps:
- name: Set up Rust
run: |
rustup set profile minimal
rustup override set stable
- uses: actions/checkout@v3
- name: Setup
shell: bash
run: |
set -ex
cargo install cargo-workspace2
- name: Bump PAC versions
if: github.event.inputs.pac_bump != 'none'
shell: bash
run: |
set -ex
# Create a fake workspace file for all PACs.
echo "[workspace]" > Cargo.toml
echo "members = [" >> Cargo.toml
for d in pac/*/ ; do echo " \"${d::-1}\"," >> Cargo.toml; done
echo "]" >> Cargo.toml
echo "" >> Cargo.toml
# Create a ws2 query string for all PACs.
pacs=$(for d in pac/*/ ; do echo -n "${d:4:${#d}-5} "; done )
pacs=${pacs::-1} # Trim trailing space
echo "y" | cargo ws2 [ "${pacs}" ] publish ${{ github.event.inputs.pac_bump }}
rm Cargo.toml
- name: Update HAL deps
if: github.event.inputs.sync_hal == 'yes'
uses: ./.github/actions/sync-pac-versions
- name: Bump HAL version
if: github.event.inputs.hal_bump != 'none'
shell: bash
run: |
set -ex
# Create a fake workspace file for the HAL.
echo "[workspace]" > Cargo.toml
echo "members = [" >> Cargo.toml
echo ' "hal",' >> Cargo.toml
echo "]" >> Cargo.toml
echo "" >> Cargo.toml
echo "y" | cargo ws2 [ "atsamd-hal" ] publish ${{ github.event.inputs.hal_bump }}
rm Cargo.toml
- name: Update BSP deps
if: github.event.inputs.sync_bsp == 'yes'
uses: ./.github/actions/sync-bsp-versions
- name: Bump BSP versions
if: github.event.inputs.bsp_bump != 'none'
shell: bash
run: |
set -ex
T1_BOARDS=$(cat crates.json | jq -Mr -c '[.boards | to_entries | map([.key, .value.tier]) | .[] | select(.[1] == 1) | .[0]] | join(" ")')
# Create a fake workspace file for all BSPs.
echo "[workspace]" > Cargo.toml
echo "members = [" >> Cargo.toml
for d in $T1_BOARDS; do echo " \"boards/${d}\"," >> Cargo.toml; done
echo "]" >> Cargo.toml
echo "" >> Cargo.toml
echo "y" | cargo ws2 [ "${T1_BOARDS}" ] publish ${{ github.event.inputs.bsp_bump }}
rm Cargo.toml
- name: Generate patch
shell: bash
run: |
git diff > bump.patch
- name: Upload diff
uses: actions/upload-artifact@v3
with:
name: bump.patch
path: bump.patch
- name: Cleanup
shell: bash
run: |
set -ex
rm bump.patch
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.ATSAMD_BOT }}
commit-message: ${{ github.event.inputs.bump }} bump of crate versions
committer: GitHub <noreply@github.com>
author: atsamd-bot <atsamd-bot@users.noreply.github.com>
signoff: false
branch: bump-versions
delete-branch: true
title: '[atsamd-bot] Bump crate versions'
body: |
Automated bump of crate versions.
- Workflow launched by `${{ github.actor }}`
- Workflow: [bump-crates.yml][1]
- PAC bump = `${{ github.event.inputs.pac_bump }}`
- HAL bump = `${{ github.event.inputs.hal_bump }}`
- BSP bump = `${{ github.event.inputs.bsp_bump }}`
[1]: https://github.com/atsamd-rs/atsamd/tree/master/.github/workflows
labels: |
automated pr
version-bump
draft: false