chore: bump to v0.8.0 #148
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: Wadm Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
workflow_dispatch: # Allow manual creation of artifacts without a release | |
jobs: | |
build: | |
name: build release assets | |
runs-on: ${{ matrix.config.os }} | |
outputs: | |
version_output: ${{ steps.version_output.outputs.version }} | |
strategy: | |
matrix: | |
config: | |
# NOTE: We are building on an older version of ubuntu because of libc compatibility | |
# issues. Namely, if we build on a new version of libc, it isn't backwards compatible with | |
# old versions. But if we build on the old version, it is compatible with the newer | |
# versions running in ubuntu 22 and its ilk | |
- { | |
os: "ubuntu-20.04", | |
arch: "amd64", | |
extension: "", | |
targetPath: "target/release/", | |
} | |
- { | |
os: "ubuntu-20.04", | |
arch: "aarch64", | |
extension: "", | |
targetPath: "target/aarch64-unknown-linux-gnu/release/", | |
} | |
- { | |
os: "macos-latest", | |
arch: "amd64", | |
extension: "", | |
targetPath: "target/release/", | |
} | |
- { | |
os: "windows-latest", | |
arch: "amd64", | |
extension: ".exe", | |
targetPath: "target/release/", | |
} | |
- { | |
os: "macos-latest", | |
arch: "aarch64", | |
extension: "", | |
targetPath: "target/aarch64-apple-darwin/release/", | |
} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set the release version (tag) | |
if: startsWith(github.ref, 'refs/tags/v') | |
shell: bash | |
run: echo "RELEASE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
- name: set the release version (main) | |
if: github.ref == 'refs/heads/main' | |
shell: bash | |
run: echo "RELEASE_VERSION=canary" >> $GITHUB_ENV | |
- name: Output Version | |
id: version_output | |
run: echo "version=$RELEASE_VERSION" >> $GITHUB_OUTPUT | |
- name: lowercase the runner OS name | |
shell: bash | |
run: | | |
OS=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') | |
echo "RUNNER_OS=$OS" >> $GITHUB_ENV | |
- name: Install latest Rust stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
if: matrix.config.arch != 'aarch64' | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
- name: setup for cross-compile builds | |
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'ubuntu-20.04' | |
run: | | |
sudo apt-get update | |
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
rustup toolchain install stable-aarch64-unknown-linux-gnu | |
rustup target add --toolchain stable-aarch64-unknown-linux-gnu aarch64-unknown-linux-gnu | |
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV | |
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV | |
- name: Install latest Rust stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'macos-latest' | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
target: aarch64-apple-darwin | |
- name: Install latest Rust stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'ubuntu-20.04' | |
with: | |
toolchain: stable | |
components: clippy, rustfmt | |
target: aarch64-unknown-linux-gnu | |
- name: build release | |
if: matrix.config.arch != 'aarch64' | |
run: "cargo build --release --bin wadm --features cli" | |
- name: build release | |
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'macos-latest' | |
run: "cargo build --release --bin wadm --features cli --target aarch64-apple-darwin" | |
- name: build release | |
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'ubuntu-20.04' | |
run: "cargo build --release --bin wadm --features cli --target aarch64-unknown-linux-gnu" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: wadm-${{ env.RELEASE_VERSION }}-${{ env.RUNNER_OS }}-${{ matrix.config.arch }} | |
if-no-files-found: error | |
path: | | |
${{ matrix.config.targetPath }}wadm${{ matrix.config.extension }} | |
publish: | |
name: publish release assets | |
runs-on: ubuntu-20.04 | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/v') | |
env: | |
RELEASE_VERSION: ${{ needs.build.outputs.version_output }} | |
steps: | |
- name: download release assets | |
uses: actions/download-artifact@v3 | |
- name: Generate Checksums | |
run: | | |
for dir in */; do | |
cd "$dir" || continue | |
sum=$(sha256sum * | awk '{ print $1 }') | |
echo "$dir:$sum" >> checksums-${{ env.RELEASE_VERSION }}.txt | |
cd .. | |
done | |
- name: Package Binaries | |
run: for dir in */; do tar -czvf "${dir%/}.tar.gz" "$dir"; done | |
- name: Publish to GHCR | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.WADM_GITHUB_TOKEN }} | |
prerelease: false | |
draft: false | |
files: | | |
checksums-${{ env.RELEASE_VERSION }}.txt | |
wadm-${{ env.RELEASE_VERSION }}-linux-aarch64.tar.gz | |
wadm-${{ env.RELEASE_VERSION }}-linux-amd64.tar.gz | |
wadm-${{ env.RELEASE_VERSION }}-macos-aarch64.tar.gz | |
wadm-${{ env.RELEASE_VERSION }}-macos-amd64.tar.gz | |
wadm-${{ env.RELEASE_VERSION }}-windows-amd64.tar.gz | |
crate: | |
name: Publish crate | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install latest Rust stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Cargo login | |
run: cargo login ${{ secrets.CRATES_TOKEN }} | |
shell: bash | |
- name: Cargo publish | |
run: cargo publish | |
shell: bash | |
docker-image: | |
name: Build and push docker images | |
runs-on: ubuntu-latest | |
needs: build | |
env: | |
RELEASE_VERSION: ${{ needs.build.outputs.version_output }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wadm-${{ env.RELEASE_VERSION }}-linux-aarch64 | |
path: ./artifacts | |
- run: mv ./artifacts/wadm ./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-aarch64 && chmod +x ./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-aarch64 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wadm-${{ env.RELEASE_VERSION }}-linux-amd64 | |
path: ./artifacts | |
- run: mv ./artifacts/wadm ./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-amd64 && chmod +x ./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-amd64 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.WADM_GITHUB_TOKEN }} | |
- name: lowercase repository owner | |
run: | | |
echo "OWNER=${GITHUB_REPOSITORY_OWNER,,}" >>$GITHUB_ENV | |
- name: Build and push (tag) | |
uses: docker/build-push-action@v3 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
context: ./ | |
build-args: | | |
BIN_ARM64=./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-aarch64 | |
BIN_AMD64=./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-amd64 | |
tags: ghcr.io/${{ env.OWNER }}/wadm:latest,ghcr.io/${{ env.OWNER }}/wadm:${{ env.RELEASE_VERSION }} | |
- name: Build and push (main) | |
uses: docker/build-push-action@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
context: ./ | |
build-args: | | |
BIN_ARM64=./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-aarch64 | |
BIN_AMD64=./artifacts/wadm-${{ env.RELEASE_VERSION }}-linux-amd64 | |
tags: ghcr.io/${{ env.OWNER }}/wadm:canary |