1
0
mirror of https://github.com/containers/youki synced 2024-11-23 17:32:15 +01:00
youki/.github/workflows/release.yml
2022-10-12 21:06:43 -03:00

132 lines
3.9 KiB
YAML

name: Release
on:
push:
tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build
run: make release-build
- name: test
run: make test-all
upload:
name: Upload
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo apt-get -y update
- run: sudo apt-get install -y pkg-config libsystemd-dev libdbus-glib-1-dev libelf-dev libseccomp-dev
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Release build
run: make release-build
- 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@v2
with:
name: output
path: output/*
release:
name: Publish Release
runs-on: ubuntu-latest
needs:
- upload
outputs:
version: ${{ steps.info.outputs.version }}
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 "::set-output name=version::${VERSION}"
echo "::set-output name=outputdir::youki_${MAJOR}_${MINOR}_${PATCH}_linux"
echo "::set-output name=innerdir::youki-${VERSION}"
- name: Create Release Draft
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ steps.info.outputs.version }} Release
draft: true
- name: Create Output Directory
run: mkdir -p ${{ steps.info.outputs.outputdir }}/${{ steps.info.outputs.innerdir }}
- name: Download Linux Artifacts
uses: actions/download-artifact@v2
with:
name: output
path: ${{ steps.info.outputs.outputdir }}/${{ steps.info.outputs.innerdir }}
- name: Restore File Modes
run: |
chmod 755 ${{ steps.info.outputs.outputdir }}/${{ steps.info.outputs.innerdir }}/youki
- name: Create tarball
run: tar -zcvf ${{ steps.info.outputs.outputdir }}.tar.gz ${{ steps.info.outputs.outputdir }}
- name: Upload Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ steps.info.outputs.outputdir }}.tar.gz
asset_name: ${{ steps.info.outputs.outputdir }}.tar.gz
asset_content_type: application/gzip
publish:
name: Publish Packages
needs: check
runs-on: ubuntu-latest
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Set up cargo
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- 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