mirror of
https://github.com/bartvdbraak/keyweave.git
synced 2025-04-28 07:11:21 +00:00
fix: additional openssl installs and dir constants
This commit is contained in:
parent
5cb9db3450
commit
0822f57137
1 changed files with 140 additions and 64 deletions
202
.github/workflows/deploy.yml
vendored
202
.github/workflows/deploy.yml
vendored
|
@ -1,84 +1,160 @@
|
||||||
name: Deploy
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v[0-9]+.[0-9]+.[0-9]+"
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-upload:
|
build:
|
||||||
name: Build and upload
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
name:
|
||||||
|
# - linux-x86-64-gnu
|
||||||
|
# - linux-x86-64-musl
|
||||||
|
# - linux-armhf-gnu
|
||||||
|
# - linux-arm64-gnu
|
||||||
|
- mac-x86-64
|
||||||
|
- mac-arm64
|
||||||
include:
|
include:
|
||||||
- build: linux
|
# - name: linux-x86-64-gnu
|
||||||
os: ubuntu-latest
|
# os: ubuntu-20.04
|
||||||
target: x86_64-unknown-linux-gnu
|
# target: x86_64-unknown-linux-gnu
|
||||||
|
# cross: false
|
||||||
|
# experimental: false
|
||||||
|
|
||||||
- build: macos
|
# - name: linux-x86-64-musl
|
||||||
os: macos-latest
|
# os: ubuntu-latest
|
||||||
target: x86_64-apple-darwin
|
# target: x86_64-unknown-linux-musl
|
||||||
|
# cross: true
|
||||||
|
# experimental: false
|
||||||
|
|
||||||
- build: windows-gnu
|
# - name: linux-armhf-gnu
|
||||||
os: windows-latest
|
# os: ubuntu-20.04
|
||||||
target: x86_64-pc-windows-gnu
|
# target: armv7-unknown-linux-gnueabihf
|
||||||
|
# cross: true
|
||||||
|
# experimental: false
|
||||||
|
|
||||||
|
# - name: linux-arm64-gnu
|
||||||
|
# os: ubuntu-20.04
|
||||||
|
# target: aarch64-unknown-linux-gnu
|
||||||
|
# cross: true
|
||||||
|
# experimental: false
|
||||||
|
|
||||||
|
- name: mac-x86-64
|
||||||
|
os: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
cross: false
|
||||||
|
experimental: false
|
||||||
|
|
||||||
|
- name: mac-arm64
|
||||||
|
os: macos-11.0
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
cross: true
|
||||||
|
experimental: true
|
||||||
|
|
||||||
|
name: Binaries for ${{ matrix.name }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
continue-on-error: ${{ matrix.experimental }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }}
|
||||||
|
|
||||||
- name: Get the release version from the tag
|
- uses: actions/cache@v3
|
||||||
shell: bash
|
if: startsWith(matrix.name, 'linux-')
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/}}" >> $GITHUB_ENV
|
with:
|
||||||
|
path: ~/.cargo/bin
|
||||||
|
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('.github/workflows/release.yml') }}
|
||||||
|
|
||||||
- name: Install development packages of OpenSSL
|
- uses: dtolnay/rust-toolchain@stable
|
||||||
shell: bash
|
with:
|
||||||
run: |
|
targets: ${{ matrix.target }}
|
||||||
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
|
|
||||||
sudo apt install -y libssl-dev
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Install Rust
|
- uses: taiki-e/setup-cross-toolchain-action@v1
|
||||||
uses: dtolnay/rust-toolchain@stable
|
with:
|
||||||
with:
|
# NB: sets CARGO_BUILD_TARGET evar - do not need --target flag in build
|
||||||
targets: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Build
|
- uses: taiki-e/install-action@cross
|
||||||
uses: actions-rs/cargo@v1
|
if: ${{ matrix.cross }}
|
||||||
with:
|
|
||||||
use-cross: true
|
|
||||||
command: build
|
|
||||||
args: --verbose --release --target ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Build archive
|
- run: cargo build --release --locked
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
# Replace with the name of your binary
|
|
||||||
binary_name="keyweave"
|
|
||||||
|
|
||||||
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
|
- name: Extract version
|
||||||
mkdir "$dirname"
|
shell: bash
|
||||||
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
run: |
|
||||||
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
|
set -euxo pipefail
|
||||||
else
|
|
||||||
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${{ matrix.os }}" = "windows-latest" ]; then
|
version=$(grep -m1 -F 'version =' Cargo.toml | cut -d\" -f2)
|
||||||
7z a "$dirname.zip" "$dirname"
|
|
||||||
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
tar -czf "$dirname.tar.gz" "$dirname"
|
|
||||||
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Release
|
if [[ -z "$version" ]]; then
|
||||||
uses: softprops/action-gh-release@v1
|
echo "Error: no version :("
|
||||||
with:
|
exit 1
|
||||||
files: |
|
fi
|
||||||
${{ env.ASSET }}
|
|
||||||
|
echo "$version" > VERSION
|
||||||
|
|
||||||
|
- name: Package
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euxo pipefail
|
||||||
|
ext=""
|
||||||
|
[[ "${{ matrix.name }}" == windows-* ]] && ext=".exe"
|
||||||
|
bin="target/${{ matrix.target }}/release/keyweave${ext}"
|
||||||
|
strip "$bin" || true
|
||||||
|
dst="keyweave-${{ matrix.target }}"
|
||||||
|
mkdir "$dst"
|
||||||
|
cp "$bin" "$dst/"
|
||||||
|
|
||||||
|
- name: Archive (tar)
|
||||||
|
if: '! startsWith(matrix.name, ''windows-'')'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euxo pipefail
|
||||||
|
dst="keyweave-${{ matrix.target }}"
|
||||||
|
tar cavf "$dst.tar.xz" "$dst"
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: builds
|
||||||
|
retention-days: 1
|
||||||
|
path: |
|
||||||
|
keyweave-*.tar.xz
|
||||||
|
|
||||||
|
sign:
|
||||||
|
needs: build
|
||||||
|
|
||||||
|
name: Checksum and sign
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/bin
|
||||||
|
key: sign-tools-${{ hashFiles('.github/workflows/release.yml') }}
|
||||||
|
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: builds
|
||||||
|
|
||||||
|
- name: Checksums with SHA512
|
||||||
|
run: sha512sum keyweave-* | tee SHA512SUMS
|
||||||
|
|
||||||
|
- uses: softprops/action-gh-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
generate_release_notes: true
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
files: |
|
||||||
|
keyweave-*.tar.xz
|
||||||
|
*SUMS*
|
Loading…
Reference in a new issue