add release workflow

This commit is contained in:
DataHearth 2022-03-06 19:43:01 +01:00
parent b9adfbf967
commit 8f050b91ae
No known key found for this signature in database
GPG Key ID: E88FD356ACC5F3C4
1 changed files with 124 additions and 0 deletions

124
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,124 @@
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
build-linux-musl:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-musl
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
use-cross: true
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: x86_64-unknown-linux-musl
path: ./target/release/clear-docker-images
build-linux-gnu:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-unknown-linux-gnu
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
use-cross: true
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: x86_64-unknown-linux-gnu
path: ./target/release/clear-docker-images
build-macos:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: x86_64-apple-darwin
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
use-cross: true
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: x86_64-apple-darwin
path: ./target/release/clear-docker-images
release:
runs-on: ubuntu-latest
needs: [build-macos, build-linux-gnu, build-linux-musl]
steps:
- name: Checkout
uses: actions/checkout@v2
- run: mkdir -p binaries
- name: download x86_64-apple-darwin
uses: actions/download-artifact@v3
with:
name: x86_64-apple-darwin
- run: mv clear-docker-images binaries/x86_64-apple-darwin
- name: download x86_64-unknown-linux-gnu
uses: actions/download-artifact@v3
with:
name: x86_64-unknown-linux-gnu
- run: mv clear-docker-images binaries/x86_64-unknown-linux-gnu
- name: download x86_64-unknown-linux-musl
uses: actions/download-artifact@v3
with:
name: x86_64-unknown-linux-musl
- run: mv clear-docker-images binaries/x86_64-unknown-linux-musl
- name: Get current and previous tags
run: |
echo ::set-output name=PREVIOUS_TAG::$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`)
echo ::set-output name=CURRENT_TAG::${GITHUB_REF/refs\/tags\//}
id: tags
- name: Release
uses: softprops/action-gh-release@v1
with:
body: "**Full Changelog**: https://github.com/DataHearth/clear-docker-images/compare/${{ steps.tags.outputs.PREVIOUS_TAG }}...${{ steps.tags.outputs.CURRENT_TAG }}"
files: |
binaries/x86_64-unknown-linux-musl
binaries/x86_64-unknown-linux-gnu
binaries/x86_64-apple-darwin