From 697a36998d5a90a17f3c5a16b7d6ad0328d1bd2f Mon Sep 17 00:00:00 2001 From: Miro Date: Fri, 13 Oct 2023 16:35:45 +0800 Subject: [PATCH] CI update for test --- .github/workflows/release.yml | 90 ++++++++++------------------------- 1 file changed, 26 insertions(+), 64 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd04d01..d371afd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }}