add earthly container image stage

This commit is contained in:
DataHearth 2022-03-16 19:12:36 +01:00
parent ffe439d698
commit a64d2f56f2
No known key found for this signature in database
GPG Key ID: E88FD356ACC5F3C4
1 changed files with 39 additions and 1 deletions

View File

@ -7,6 +7,7 @@ on:
jobs:
build-linux-musl:
name: Build Linux MUSL artefact
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -32,6 +33,7 @@ jobs:
path: ./target/release/clear-docker-images
build-linux-gnu:
name: Build Linux GNU artefact
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -57,6 +59,7 @@ jobs:
path: ./target/release/clear-docker-images
build-macos:
name: Build MacOS artefact
runs-on: macos-latest
steps:
- name: Checkout
@ -81,12 +84,47 @@ jobs:
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@v2
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: mkdir -p binaries