1
0
mirror of https://github.com/containers/youki synced 2024-11-23 17:32:15 +01:00
youki/.github/workflows/release.yml
Toru Komatsu d40c8ea2a0
Fix the release workflow. (#2070)
Signed-off-by: utam0k <k0ma@utam0k.jp>
2023-06-20 20:11:11 +05:30

116 lines
3.4 KiB
YAML

name: Release
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
jobs:
check:
name: Check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- name: Install just
uses: taiki-e/install-action@just
- name: Install requirements
run: sudo env PATH=$PATH just ci-prepare
- name: Build
run: just youki-release
- name: test
# TODO(utam0k): The feature test needs nightly
# run: just unittest featuretest oci-tests
run: just unittest oci-tests
upload:
name: Upload
needs: check
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- uses: taiki-e/install-action@just
- name: Install requirements
run: sudo env PATH=$PATH just ci-prepare
- name: Release build
run: just youki-release
- name: Create output directory
run: mkdir output
- name: Copy files to output
run: |
cp youki output/
cp README.md output/README.md
cp LICENSE output/LICENSE
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: output
path: output/*
release:
name: Create Draft Release
runs-on: ubuntu-20.04
needs:
- upload
steps:
- uses: actions/checkout@v3
- name: Determine Release Info
id: info
env:
GITHUB_REF: ${{ github.ref }}
run: |
VERSION=${GITHUB_REF##*v}
MAJOR=${VERSION%%.*}
MINOR=${VERSION%.*}
MINOR=${MINOR#*.}
PATCH=${VERSION##*.}
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "OUTPUTDIR=youki_${MAJOR}_${MINOR}_${PATCH}_linux" >> $GITHUB_ENV
echo "INNERDIR=youki-${VERSION}" >> $GITHUB_ENV
- name: Create Output Directory
run: mkdir -p ${{ env.OUTPUTDIR }}/${{ env.INNERDIR }}
- name: Download Linux Artifacts
uses: actions/download-artifact@v3
with:
name: output
path: ${{ env.OUTPUTDIR }}/${{ env.INNERDIR }}
- name: Restore File Modes
run: |
chmod 755 ${{ env.OUTPUTDIR }}/${{ env.INNERDIR }}/youki
- name: Create tarball
run: tar -zcvf ${{ env.OUTPUTDIR }}.tar.gz ${{ env.OUTPUTDIR }}
- name: Create Release Draft
uses: softprops/action-gh-release@v1
with:
name: ${{ env.VERSION }} Release
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
files: ./${{ env.OUTPUTDIR }}.tar.gz
publish:
name: Publish Packages
needs: check
runs-on: ubuntu-20.04
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain and cache
uses: actions-rust-lang/setup-rust-toolchain@v1.3.7
- 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