Skip to content

Updated version

Updated version #24

Workflow file for this run

name: Deploy
on:
push:
tags: [ "v*.*.*" ]
env:
CARGO_TERM_COLOR: always
jobs:
build-win-binaries:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
choco install -y ninja
pip install meson
- uses: ilammy/setup-nasm@v1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-pc-windows-msvc
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Build rimage
shell: cmd
run: |
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
cargo build --release --target x86_64-pc-windows-msvc --verbose
- name: Get the version
shell: bash
id: tagName
run: |
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "::set-output name=tag::$VERSION"
- name: Build package
id: package
shell: bash
run: |
ARCHIVE_TARGET="x86_64-pc-windows-msvc"
ARCHIVE_NAME="rimage-${{ steps.tagName.outputs.tag }}-$ARCHIVE_TARGET"
ARCHIVE_FILE="${ARCHIVE_NAME}.zip"
mv LICENSE-MIT LICENSE-MIT.txt
mv LICENSE-APACHE LICENSE-APACHE.txt
7z a ${ARCHIVE_FILE} \
./target/x86_64-pc-windows-msvc/release/rimage.exe \
./CHANGELOG.md ./LICENSE-MIT.txt ./LICENSE-APACHE.txt ./README.md
echo "::set-output name=file::${ARCHIVE_FILE}"
echo "::set-output name=name::${ARCHIVE_NAME}.zip"
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ steps.package.outputs.name }}
path: ${{ steps.package.outputs.file }}
build-unix-binaries:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: x86_64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Install dependencies (linux)
if: matrix.os == 'ubuntu-latest'
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y ninja-build nasm meson
- name: Install dependencies (macOS)
if: matrix.os == 'macOS-latest'
run: |
brew install ninja nasm meson
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Build rimage
run: cargo build --release --target ${{ matrix.target }} --verbose
- name: Strip binary
run: |
strip target/${{ matrix.target }}/release/rimage
- name: Get the version
shell: bash
id: tagName
run: |
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
echo "::set-output name=tag::$VERSION"
- name: Build package
id: package
run: |
ARCHIVE_TARGET=${{ matrix.target }}
ARCHIVE_NAME="rimage-${{ steps.tagName.outputs.tag }}-$ARCHIVE_TARGET"
ARCHIVE_FILE="${ARCHIVE_NAME}.tar.gz"
mkdir "/tmp/${ARCHIVE_NAME}"
cp README.md CHANGELOG.md LICENSE-MIT LICENSE-APACHE \
target/${{ matrix.target }}/release/rimage \
/tmp/${ARCHIVE_NAME}
tar -czf ${PWD}/${ARCHIVE_FILE} -C /tmp/ ${ARCHIVE_NAME}
echo ::set-output "name=file::${ARCHIVE_FILE}"
echo ::set-output "name=name::${ARCHIVE_NAME}.tar.gz"
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ steps.package.outputs.name }}
path: ${{ steps.package.outputs.file }}
deploy:
needs: [build-win-binaries, build-unix-binaries]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get version and release description
id: tagName
run: |
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
tail -n +3 CHANGELOG.md | sed -e '/^$/,$d' > CHANGELOG.txt
echo "::set-output name=tag::$VERSION"
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: ./binaries
- name: Create a release
uses: softprops/action-gh-release@v1
with:
name: v${{ steps.tagName.outputs.tag }}
body_path: CHANGELOG.txt
files: |
./binaries/**/*.zip
./binaries/**/*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y ninja-build nasm meson
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-unknown-linux-musl
override: true
- name: Install musl
if: contains(matrix.target, 'linux-musl')
run: |
sudo apt-get install musl-tools
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Publish to crates.io
run: |
cargo login ${{ secrets.CRATES_TOKEN }}
cargo publish