forked from rusty-celery/rusty-celery
-
Notifications
You must be signed in to change notification settings - Fork 0
116 lines (99 loc) · 3.19 KB
/
release.yml
File metadata and controls
116 lines (99 loc) · 3.19 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
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
name: Release
on:
push:
tags:
- 'v*.*.*'
jobs:
publish_workspace_crates:
name: Publish workspace crate (${{ matrix.crate }})
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
crate: [celery-codegen]
steps:
- uses: actions/checkout@v3
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Log in to crates.io
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CARGO_TOKEN }}
- name: Publish ${{ matrix.crate }} to crates.io
run: |
cd ${{ matrix.crate }}
cargo publish
publish_celery_crate:
name: Publish celery crate
runs-on: ubuntu-latest
needs: [publish_workspace_crates]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Prepare environment
run: |
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV;
- name: Install jq and curl
run: |
sudo apt-get update
sudo apt-get install -y jq curl
- name: Log in to crates.io
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CARGO_TOKEN }}
- name: Wait for workspace crates to update on crates.io
run: |
for subcrate in 'celery-codegen' ; do
echo "Waiting for $subcrate to update on crates.io..."
for delay in 1 5 10 20 ; do
sleep $delay
subcrate_version=$(curl "https://crates.io/api/v1/crates/$subcrate" 2> /dev/null | jq -r '.crate.newest_version')
echo "Latest version pulled: $subcrate_version"
if [ "$VERSION" == "$subcrate_version" ]; then
echo "$subcrate up-to-date!"
break
else
if [ "$delay" == "20" ]; then
echo "$subcrate failed to update on crates.io"
exit 1
fi
fi
done
done
- name: Publish celery to crates.io
run: |
cargo publish
publish_github_release:
name: Publish github release
runs-on: ubuntu-latest
needs: [publish_celery_crate]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Prepare environment
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV;
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Generate release notes
run: |
python scripts/generate_release_notes.py > ${{ github.workspace }}-RELEASE_NOTES.md
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: ${{ github.workspace }}-RELEASE_NOTES.md
prerelease: ${{ contains(env.TAG, '-rc') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}