chore: update changelog #122
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
name: Check | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
components: rustfmt, clippy | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v3 | |
- run: | | |
cargo check --locked | |
cargo fmt --all -- --check | |
cargo clippy -- -Dwarnings | |
tests: | |
if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/pull/') | |
needs: lint | |
runs-on: ubuntu-latest | |
name: Tests | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v3 | |
- run: cargo test | |
build-windows: | |
if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/pull/') | |
needs: [lint, tests] | |
runs-on: windows-latest | |
name: Release build for Windows | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v3 | |
- name: Build release binary | |
run: cargo build --release | |
env: | |
RUSTFLAGS: '-C target-feature=+crt-static' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: awsbck-windows | |
path: target/release/awsbck.exe | |
build-macos: | |
if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/pull/') | |
needs: [lint, tests] | |
runs-on: macos-latest | |
name: Release build for macOS | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v3 | |
- name: Build release binary | |
run: cargo build --release | |
env: | |
LZMA_API_STATIC: 'true' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: awsbck-macos | |
path: target/release/awsbck | |
build-macos-arm: | |
if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/pull/') | |
needs: [lint, tests] | |
runs-on: macos-latest | |
name: Release build for macOS aarch64 | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '14.2' | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: aarch64-apple-darwin | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v3 | |
- name: Build release binary | |
run: | | |
SDKROOT=$(xcrun -sdk macosx13.1 --show-sdk-path) \ | |
MACOS_DEPLOYMENT_TARGET=$(xcrun -sdk macosx13.1 --show-sdk-platform-version) \ | |
cargo build --release --target=aarch64-apple-darwin | |
env: | |
LZMA_API_STATIC: 'true' | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: awsbck-macos-aarch64 | |
path: target/aarch64-apple-darwin/release/awsbck | |
build-linux: | |
if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/pull/') | |
needs: [lint, tests] | |
runs-on: ubuntu-latest | |
name: Release build for linux x86_64 | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-unknown-linux-musl | |
- uses: Swatinem/rust-cache@v2 | |
- name: Install musl tools | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends musl-tools | |
- uses: actions/checkout@v3 | |
- name: Build release binary | |
run: cargo build --release --target x86_64-unknown-linux-musl | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: awsbck-linux | |
path: target/x86_64-unknown-linux-musl/release/awsbck | |
build-arm: | |
if: github.ref_type == 'tag' || startsWith(github.ref, 'refs/pull/') | |
needs: [lint, tests] | |
name: Release builds for linux ARM | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- target: aarch64-unknown-linux-musl | |
arch: aarch64 | |
- target: armv7-unknown-linux-gnueabihf | |
arch: armv7 | |
steps: | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo install cross --git https://github.com/cross-rs/cross | |
- uses: actions/checkout@v3 | |
- run: cross build --release --target ${{ matrix.target }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: awsbck-${{ matrix.arch }} | |
path: target/${{ matrix.target }}/release/awsbck | |
build-docker: | |
if: github.ref_type == 'tag' | |
needs: [build-linux, build-arm] | |
name: Create docker container | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: awsbck-linux | |
path: linux_amd64/awsbck | |
- uses: actions/download-artifact@v3 | |
with: | |
name: awsbck-aarch64 | |
path: linux_arm64/awsbck | |
- uses: actions/download-artifact@v3 | |
with: | |
name: awsbck-armv7 | |
path: linux_arm/awsbck | |
- name: Login to Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker metadata for root image | |
id: meta-root | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/awsbck | |
flavor: | | |
latest=false | |
tags: | | |
type=semver,pattern=root-{{version}} | |
type=semver,pattern=root-{{major}}.{{minor}} | |
type=raw,value=root-latest | |
- name: Build and push for root image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: . | |
file: Dockerfile.root | |
tags: ${{ steps.meta-root.outputs.tags }} | |
labels: ${{ steps.meta-root.outputs.labels }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Docker metadata # generates tags (version number and "latest") and labels | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/${{ github.repository_owner }}/awsbck | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: . | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
make-release: | |
if: github.ref_type == 'tag' | |
needs: [build-linux, build-arm, build-windows, build-macos, build-macos-arm] | |
name: Create Github release | |
runs-on: ubuntu-latest | |
environment: Cargo | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: publish to crates.io | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
run: cargo publish | |
- name: extract version from Cargo.toml | |
uses: SebRollen/[email protected] | |
id: version | |
with: | |
file: Cargo.toml | |
field: package.version | |
- name: download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: create release directory | |
run: mkdir release | |
- name: create release files | |
run: | | |
tar -C ./artifacts/awsbck-linux -czvf ./release/awsbck-v${{ steps.version.outputs.value }}-linux-x64.tar.gz awsbck | |
tar -C ./artifacts/awsbck-aarch64 -czvf ./release/awsbck-v${{ steps.version.outputs.value }}-linux-aarch64.tar.gz awsbck | |
tar -C ./artifacts/awsbck-armv7 -czvf ./release/awsbck-v${{ steps.version.outputs.value }}-linux-armv7.tar.gz awsbck | |
zip -j ./release/awsbck-v${{ steps.version.outputs.value }}-windows.zip ./artifacts/awsbck-windows/awsbck.exe | |
zip -j ./release/awsbck-v${{ steps.version.outputs.value }}-macos.zip ./artifacts/awsbck-macos/awsbck | |
zip -j ./release/awsbck-v${{ steps.version.outputs.value }}-macos-aarch64.zip ./artifacts/awsbck-macos-aarch64/awsbck | |
- name: release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: awsbck v${{ steps.version.outputs.value }} | |
generate_release_notes: true | |
files: | | |
release/*.tar.gz | |
release/*.zip | |
changelog: | |
if: github.ref == 'refs/heads/main' | |
name: Generate changelog | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
fetch-depth: 0 | |
- uses: orhun/git-cliff-action@v2 | |
id: git-cliff | |
with: | |
config: cliff.toml | |
env: | |
OUTPUT: CHANGELOG.md | |
- name: Print changelog | |
run: cat "./CHANGELOG.md" | |
- name: commit changelog | |
run: | | |
git config --global user.name 'beeb' | |
git config --global user.email '[email protected]' | |
git commit -am "chore: update changelog" | |
git push |