Skip to content

chore: release v0.1.7 (#147) #367

chore: release v0.1.7 (#147)

chore: release v0.1.7 (#147) #367

Workflow file for this run

on:
pull_request: {}
push:
branches:
- master
tags: [ 'v*.*.*' ]
name: CI
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: Check that Cargo.lock is up-to-date
run: cargo metadata --format-version 1 --locked
- name: Run cargo fmt
run: cargo fmt --check
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Run cargo check
run: cargo check
test:
strategy:
matrix:
runner: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
- name: Run cargo test
run: cargo test
versions:
runs-on: ubuntu-latest
steps:
- uses: taiki-e/install-action@v2
with:
tool: cargo-hack,cargo-minimal-versions
- name: Checkout sources
uses: actions/checkout@v3
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
# Check with minimal dependency versions and MSRV from Cargo.toml
- name: Check minimal versions
run: cargo minimal-versions check --rust-version --features vendored-openssl,vendored-libgit2
semver:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Check semver
uses: obi1kenobi/cargo-semver-checks-action@v2
flake:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install nix
uses: DeterminateSystems/nix-installer-action@v12
- name: Cache nix dependencies
uses: DeterminateSystems/magic-nix-cache-action@v7
- name: Build
run: nix flake check
update-release-draft:
runs-on: ubuntu-latest
if: github.repository == 'coralogix/protofetch' && github.ref == 'refs/heads/master'
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
package:
needs: [ lint, test, versions, semver ]
strategy:
fail-fast: false
matrix:
target:
- rust: aarch64-unknown-linux-musl
runner: ubuntu-latest
tar: tar
cross: true
ext:
- rust: x86_64-unknown-linux-musl
runner: ubuntu-latest
tar: tar
cross: true
ext:
- rust: aarch64-apple-darwin
runner: macos-14
# We use gtar to make sure compressed files are not detected as sparse
tar: gtar
cross: false
ext:
- rust: x86_64-apple-darwin
runner: macos-12
# We use gtar to make sure compressed files are not detected as sparse
tar: gtar
cross: false
ext:
- rust: x86_64-pc-windows-msvc
runner: windows-latest
tar: tar
cross: false
ext: '.exe'
runs-on: ${{ matrix.target.runner }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target.rust }}
- name: Install cross
if: ${{ matrix.target.cross }}
run: cargo install --locked cross
- name: Build
run: ${{ matrix.target.cross && 'cross' || 'cargo' }} build --release --target ${{ matrix.target.rust }} --features vendored-openssl,vendored-libgit2
- name: Package
run: |
mv target/${{ matrix.target.rust }}/release bin/
${{ matrix.target.tar }} -czvf protofetch_${{ matrix.target.rust }}.tar.gz bin/protofetch${{ matrix.target.ext }}
- name: Upload
uses: actions/upload-artifact@v3
with:
name: packages
path: protofetch_${{ matrix.target.rust }}.tar.gz
release:
runs-on: ubuntu-latest
if: github.repository == 'coralogix/protofetch' && startsWith(github.ref, 'refs/tags/')
needs: [ package ]
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Publish cargo package
run: cargo publish --token ${{ env.CRATES_IO_TOKEN }}
- name: Publish npm package
run: |
VERSION=$(sed -n -e '/version/ s/.* = *//p' "Cargo.toml" | head -1 | tr -d '"')
export VERSION
# Tee had issue to write to the same file which is used for read so creating a temp package.json file
mv .github/npm/package.json .github/npm/package.json.temp
sed "s/VERSION#TO#REPLACE/${VERSION}/g" .github/npm/package.json.temp | tee .github/npm/package.json
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ".npmrc"
npm publish .github/npm
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: packages
- name: Upload release artifacts
uses: softprops/action-gh-release@v1
with:
files: |
protofetch_aarch64-unknown-linux-musl.tar.gz
protofetch_x86_64-unknown-linux-musl.tar.gz
protofetch_aarch64-apple-darwin.tar.gz
protofetch_x86_64-apple-darwin.tar.gz
protofetch_x86_64-pc-windows-msvc.tar.gz