Skip to content

Commit

Permalink
CI update for test
Browse files Browse the repository at this point in the history
  • Loading branch information
miroim committed Oct 13, 2023
1 parent fd73f80 commit 697a369
Showing 1 changed file with 26 additions and 64 deletions.
90 changes: 26 additions & 64 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,77 +4,39 @@ name: release
on:
push:
tags:
- '*.*.*' #Run when tag matches *.*.*, i.e. 0.0.1
- '[0-9]+.*'

jobs:
build:
env:
RUST_BACKTRACE: 1
name: Build release artifacts for ${{ matrix.os }}
binaries:
name: 'Upload release binaries'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-musl
bin: mdbook-i18n-helpers
- os: windows-2022
rust: stable
target: x86_64-pc-windows-msvc
bin: mdbook-i18n-helpers.exe
- os: macos-11
rust: stable
target: x86_64-apple-darwin
bin: mdbook-i18n-helpers
- os: macos-11
rust: stable
target: aarch64-apple-darwin
bin: mdbook-i18n-helpers
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: universal-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/upload-rust-binary-action@v1
with:
toolchain: ${{ matrix.rust }}
override: true
bin: cargo-tarpaulin
target: ${{ matrix.target }}
- name: Install musl tools
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get install -y musl-tools
- name: Checkout
uses: actions/checkout@v3
- name: cargo fetch
run: cargo fetch --target ${{ matrix.target }}
- name: Release build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
name=mdbook-i18n-helpers
tag=$(git describe --tags --abbrev=0)
release_name="$name-$tag-${{ matrix.target }}"
release_tar="${release_name}.tar.gz"
mkdir "$release_name"
if [ "${{ matrix.target }}" != "x86_64-pc-windows-msvc" ]; then
strip "target/${{ matrix.target }}/release/${{ matrix.bin }}"
fi
ls -al target/${{ matrix.target }}/release/
cp "target/${{ matrix.target }}/release/${{ matrix.bin }}" "$release_name/"
cp README.md LICENSE.md "$release_name/"
tar czvf "$release_tar" "$release_name"
rm -r "$release_name"
# Windows environments in github actions don't have the gnu coreutils installed,
# which includes the shasum exe, so we just use powershell instead
if [ "${{ matrix.target }}" == "x86_64-pc-windows-msvc" ]; then
echo "(Get-FileHash \"${release_tar}\" -Algorithm SHA256).Hash | Out-File -Encoding ASCII -NoNewline \"${release_tar}.sha256\"" | pwsh -c -
else
echo -n "$(shasum -ba 256 "${release_tar}" | cut -d " " -f 1)" > "${release_tar}.sha256"
fi
- name: Publish
uses: softprops/action-gh-release@v1
with:
draft: true
files: 'mdbook-i18n-helpers*'
features: vendored-openssl
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 697a369

Please sign in to comment.