forked from youki-dev/youki
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (106 loc) · 3.37 KB
/
release.yaml
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
name: 🚀 Release
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
workflow_dispatch:
jobs:
parse:
runs-on: ubuntu-latest
name: Parse ref
outputs:
version: ${{ steps.parse.outputs.version }}
steps:
- id: parse
name: Parse ref
run: echo "version=${GITHUB_REF##refs/tags/v}" >> ${GITHUB_OUTPUT}
build:
name: Build
runs-on: ubuntu-22.04
needs:
- parse
strategy:
matrix:
arch: [ "x86_64", "aarch64" ]
libc: [ "gnu", "musl" ]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1
env:
RUST_CACHE_KEY_OS: rust-cache-${{ matrix.arch }}-${{ matrix.libc }}
- name: Install just
uses: taiki-e/install-action@just
- name: Install cross-rs
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Setup target
run: |
echo "CARGO=cross" >> ${GITHUB_ENV}
echo "TARGET=${{ matrix.arch }}-unknown-linux-${{ matrix.libc }}" >> ${GITHUB_ENV}
- name: Release build
run: just youki-release
- name: test
# TODO(utam0k): The feature test needs nightly
# run: just test-basic featuretest test-oci
if: ${{ matrix.arch == 'x86_64' }}
run: just test-basic test-oci
- name: Create output directory
run: mkdir output
- name: Create artifact
run: tar -zcvf youki-${{ needs.parse.outputs.version }}-${{ matrix.arch }}-${{ matrix.libc }}.tar.gz youki README.md LICENSE
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: youki-${{ matrix.arch }}-${{ matrix.libc }}
path: youki-${{ needs.parse.outputs.version }}-${{ matrix.arch }}-${{ matrix.libc }}.tar.gz
release:
name: Create Draft Release
environment:
name: release
runs-on: ubuntu-22.04
permissions:
contents: write
needs:
- parse
- build
steps:
- uses: actions/checkout@v4
- name: Create artifacts directory
run: mkdir -p artifacts
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Show artifacts
run: ls -alhR artifacts
- name: Create release draft
shell: bash
run: |
set -x
gh release create "${{ github.ref }}" --generate-notes --draft
gh release upload "${{ github.ref }}" artifacts/*/*
env:
GH_TOKEN: ${{ github.token }}
RELEASE_NAME: "${{ needs.parse.outputs.version }} Release"
publish:
name: Publish Packages
needs: build
environment:
name: release
runs-on: ubuntu-22.04
if: ${{ github.repository == 'containers/youki' }}
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Publish libcgroups
run: cargo publish -p libcgroups --no-verify
- name: Publish libcontainer
run: cargo publish -p libcontainer --no-verify
- name: Publish liboci-cli
run: cargo publish -p liboci-cli --no-verify
- name: Publish youki
run: cargo publish -p youki --no-verify