163 lines
4.6 KiB
YAML
163 lines
4.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
|
|
jobs:
|
|
build-linux-musl:
|
|
name: Build Linux MUSL artefact
|
|
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:
|
|
name: Build Linux GNU artefact
|
|
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:
|
|
name: Build MacOS artefact
|
|
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
|
|
|
|
container-images:
|
|
name: Create and deploy container images
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Setup Earthly
|
|
uses: earthly/actions-setup@v1
|
|
with:
|
|
version: "latest"
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v1
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Get current tag
|
|
id: tags
|
|
run: echo ::set-output name=CURRENT_TAG::${GITHUB_REF/refs\/tags\//}
|
|
|
|
- name: build and push
|
|
run: earthly --build-arg VERSION=${{ steps.tags.outputs.CURRENT_TAG }} --build-arg DOCKER_IMG=datahearth/clear-docker-images --build-arg GHCR_IMG=ghcr.io/datahearth/clear-docker-images --push +build-images
|
|
|
|
release:
|
|
name: Create release and upload artefacts
|
|
runs-on: ubuntu-latest
|
|
needs: [build-macos, build-linux-gnu, build-linux-musl]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- 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
|