-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (69 loc) · 2.85 KB
/
Copy pathrelease.yml
File metadata and controls
87 lines (69 loc) · 2.85 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
# The `release` operation is never automatic; you must manually invoke the workflow explicitly
name: release
"on":
workflow_dispatch:
inputs:
bumpLevel:
description: 'Which version number to bump (either patch, minor, or major)'
required: true
env:
# Just a reassurance to mitigate sudden network connection problems
CARGO_NET_RETRY: 50
RUSTUP_MAX_RETRIES: 50
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
CARGO_REGISTRIES_ELASTIO_PRIVATE_TOKEN: ${{ secrets.CLOUDSMITH_API_TOKEN }}
# We don't need any debug symbols on ci, this also speeds up builds a bunch
RUSTFLAGS: --deny warnings -Cdebuginfo=0
RUSTDOCFLAGS: --deny warnings
jobs:
# This is just a sanity check to make sure the code is minimally correct.
# It's assumed that this is being performed on a repo with a green `master` that has passed all checks
rust-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions-rs/toolchain@v1
with:
profile: minimal
components: rustfmt, clippy
- run: git config --global credential.helper store && echo https://token:${{ secrets.PRIVATE_REGISTRY_TOKEN }}@dl.cloudsmith.io > $HOME/.git-credentials
- run: sudo apt-get install -y linux-headers-$(uname -r)
- run: cargo fmt --all -- --check
- run: cargo doc --workspace --no-deps
- run: cargo clippy --workspace --all-targets --all-features
publish-crates:
# Publishing happens only on pushes to master. Other branches and PRs don't count
if: ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-latest
# This job must execute only if all checks pass!
needs:
- rust-lint
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_TOKEN }}
steps:
# NASTY: This token must be the PAT of a user who has admin access to the repo
# in order to bypass branch protections and commit directly to master.
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.TSAR_FERRIS_GITHUB_TOKEN }}
- uses: actions-rs/toolchain@v1
with:
profile: minimal
# Install cloudsmith CLI via pip
- uses: actions/setup-python@v4
- run: pip install cloudsmith-cli
# A committer identity is required in order to commit things
- run: |
git config user.name "Tsar Ferris"
git config user.email tsar-ferris@elastio.com
- run: git config --global credential.helper store && echo https://token:${{ secrets.PRIVATE_REGISTRY_TOKEN }}@dl.cloudsmith.io > $HOME/.git-credentials
- name: Install xelastio
uses: elastio/actions/install@v1
with:
tool: xelastio
# Perform the actual release operations
- run: cargo xelastio publish release ${{ github.event.inputs.bumpLevel }}