forked from containerd/runwasi
-
Notifications
You must be signed in to change notification settings - Fork 3
118 lines (112 loc) · 4.06 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
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
name: release
concurrency:
group: release-${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
on:
push:
tags:
- '**/v[0-9]+.[0-9]+.*'
env:
CARGO_TERM_COLOR: always
jobs:
parse:
runs-on: ubuntu-latest
name: Parse ref
outputs:
crate: ${{ steps.parse.outputs.crate }}
version: ${{ steps.parse.outputs.version }}
runtime: ${{ steps.parse.outputs.runtime }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- id: parse
name: Parse ref
shell: bash
run: ./scripts/parse_ref.sh ${{ github.ref }} >> ${GITHUB_OUTPUT}
build:
needs:
- parse
strategy:
matrix:
arch: ["x86_64", "aarch64"]
runs-on: "ubuntu-22.04"
steps:
- uses: actions/checkout@v3
- name: Setup build env
run: ./scripts/setup-linux.sh
- uses: actions-rust-lang/setup-rust-toolchain@v1
env:
RUST_CACHE_KEY_OS: rust-release-cache-${{ needs.parse.outputs.crate }}-${{ matrix.arch }}
with:
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
- name: Setup cross-rs
run: ./scripts/setup-cross.sh ${{ matrix.arch }}-unknown-linux-musl
- name: Setup build profile
shell: bash
run: echo "OPT_PROFILE=release" >> ${GITHUB_ENV}
- name: Build
timeout-minutes: 20
run: make build-${{ needs.parse.outputs.runtime }}
- name: Test
if: ${{ matrix.arch == 'x86_64' }}
timeout-minutes: 10
run: make test-${{ needs.parse.outputs.runtime }}
- name: Package artifacts
if: ${{ needs.parse.outputs.runtime != 'wasm' }}
shell: bash
run: |
make dist-${{ needs.parse.outputs.runtime }}
# Check if there's any files to archive as tar fails otherwise
if stat dist/bin/* >/dev/null 2>&1; then
tar -czf dist/containerd-shim-${{ needs.parse.outputs.runtime }}-${{ matrix.arch }}.tar.gz -C dist/bin .
else
tar -czf dist/containerd-shim-${{ needs.parse.outputs.runtime }}-${{ matrix.arch }}.tar.gz -T /dev/null
fi
- name: Upload artifacts
if: ${{ needs.parse.outputs.runtime != 'wasm' }}
uses: actions/upload-artifact@master
with:
name: containerd-shim-${{ needs.parse.outputs.runtime }}-${{ matrix.arch }}
path: dist/containerd-shim-${{ needs.parse.outputs.runtime }}-${{ matrix.arch }}.tar.gz
release:
permissions:
contents: write
needs:
- build
- parse
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup build env
run: ./scripts/setup-linux.sh
- name: Download artifacts
if: ${{ needs.parse.outputs.runtime != 'wasm' }}
uses: actions/download-artifact@master
with:
path: release
- name: Create release
run: |
gh release create ${{ github.ref }} --generate-notes --prerelease
env:
GH_TOKEN: ${{ github.token }}
RELEASE_NAME: ${{ needs.parse.outputs.crate }}/${{ needs.parse.outputs.version }}
- name: Upload release artifacts
if: ${{ needs.parse.outputs.runtime != 'wasm' }}
run: |
for i in release/*/*; do
gh release upload ${RELEASE_NAME} $i
done
env:
GH_TOKEN: ${{ github.token }}
RELEASE_NAME: ${{ needs.parse.outputs.crate }}/${{ needs.parse.outputs.version }}
- name: Cargo publish
run: cargo publish --package ${{ needs.parse.outputs.crate }} --verbose --locked
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}
- name: Check crates.io ownership
run: |
cargo owner --add github:containerd:runwasi-committers ${{ needs.parse.outputs.crate }}
cargo owner --list ${{ needs.parse.outputs.crate }} | grep github:containerd:runwasi-committers
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_PUBLISH_TOKEN }}