-
Notifications
You must be signed in to change notification settings - Fork 88
70 lines (60 loc) · 1.72 KB
/
publish.yml
File metadata and controls
70 lines (60 loc) · 1.72 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
# Automates crate publishing
# - Submit a PR to bump crate version.
# - Specify crate to publish from the menu.
# - Launch the job:
# + The job will extract version from Cargo.toml
# + Will publish to crates.io
# + Will add and push a git tag "<crate>-v<version>"
name: Release
on:
workflow_dispatch:
inputs:
crate:
description: 'Crate to publish'
required: true
type: choice
options:
- client
- logging
- runc
- runc-shim
- shim
- shim-protos
- snapshots
dryrun:
description: 'Dry run'
required: false
type: boolean
default: false
jobs:
publish:
name: 'Publish ${{ inputs.crate }}'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
env:
CARGO_FILE: "crates/${{ inputs.crate }}/Cargo.toml"
steps:
- uses: actions/checkout@v6
- name: Extract package version
id: extract_version
run: |
cargo generate-lockfile
echo "version=$(cargo pkgid --manifest-path $CARGO_FILE | sed 's/.*@//')" >> $GITHUB_OUTPUT
- name: Install protobuf
run: |
sudo apt update
sudo apt install protobuf-compiler
- name: Publish on crates.io
run: cargo publish $DRYRUN --manifest-path $CARGO_FILE
env:
DRYRUN: ${{ inputs.dryrun && '--dry-run' || '' }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Push version tag
if: ${{ !inputs.dryrun }}
env:
TAG: "${{ inputs.crate }}-v${{ steps.extract_version.outputs.version }}"
run: |
git tag $TAG
git push origin $TAG