feat: add a checksum to released files #97
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: Build | |
on: [push] | |
permissions: | |
id-token: write | |
packages: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Retrieve environment variables | |
run: make env >> $GITHUB_ENV | |
- name: Copy default Cartesi Linux config | |
run: make cartesi-linux-config | |
- name: Docker meta | |
id: docker_meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: | | |
ghcr.io/${{ github.repository_owner }}/linux-kernel | |
docker.io/${{ github.repository_owner }}/linux-kernel,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/v') }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download dependencies | |
run: make download | |
- name: Set up Depot CLI | |
uses: depot/setup-action@v1 | |
- name: Build docker image | |
id: docker_build | |
uses: depot/build-push-action@v1 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
tags: cartesi/linux-kernel:devel | |
push: false | |
load: true | |
build-args: | | |
TOOLCHAIN_REPOSITORY=${{ env.TOOLCHAIN_REPOSITORY }} | |
TOOLCHAIN_VERSION=${{ env.TOOLCHAIN_VERSION }} | |
KERNEL_VERSION=${{ env.KERNEL_VERSION }} | |
IMAGE_KERNEL_VERSION=${{ env.IMAGE_KERNEL_VERSION }} | |
RISCV_PK_VERSION=${{ env.RISCV_PK_VERSION }} | |
cache-from: type=gha,scope=regular | |
cache-to: type=gha,mode=max,scope=regular | |
project: ${{ vars.DEPOT_PROJECT }} | |
- name: Export linux.bin artifact | |
run: make copy | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: artifacts/* | |
- name: Checksum artifacts | |
run: | | |
for f in artifacts/* do | |
sha512sum $f > $f.sha512 | |
end | |
- uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
prerelease: true | |
files: | | |
artifacts/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }} | |
- name: Push docker image | |
id: docker_push | |
uses: depot/build-push-action@v1 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
push: true | |
load: false | |
build-args: | | |
TOOLCHAIN_REPOSITORY=${{ env.TOOLCHAIN_REPOSITORY }} | |
TOOLCHAIN_VERSION=${{ env.TOOLCHAIN_VERSION }} | |
KERNEL_VERSION=${{ env.KERNEL_VERSION }} | |
IMAGE_KERNEL_VERSION=${{ env.IMAGE_KERNEL_VERSION }} | |
RISCV_PK_VERSION=${{ env.RISCV_PK_VERSION }} | |
cache-from: type=gha,scope=regular | |
cache-to: type=gha,mode=max,scope=regular | |
project: ${{ vars.DEPOT_PROJECT }} |