build-crankshaft #72
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-crankshaft | |
on: | |
# schedule: | |
# - cron: '0 10 * * *' # everyday at 10am | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: true | |
default: 'DEV' | |
# pull_request: | |
jobs: | |
buildimage: | |
runs-on: ubuntu-latest | |
outputs: | |
artifact_path: ${{ steps.get-artifact-name.outputs.artifact_path }} | |
artifact_filename: ${{ steps.get-artifact-name.outputs.artifact_filename }} | |
md5_path: ${{ steps.get-artifact-name.outputs.md5_path }} | |
md5_filename: ${{ steps.get-artifact-name.outputs.md5_filename }} | |
sha1_path: ${{ steps.get-artifact-name.outputs.sha1_path }} | |
sha1_filename: ${{ steps.get-artifact-name.outputs.sha1_filename }} | |
sha256_path: ${{ steps.get-artifact-name.outputs.sha256_path }} | |
sha256_filename: ${{ steps.get-artifact-name.outputs.sha256_filename }} | |
pi2_artifact_path: ${{ steps.get-artifact-name.outputs.artifact_path }} | |
pi2_artifact_filename: ${{ steps.get-artifact-name-pi2.outputs.artifact_filename }} | |
pi2_md5_path: ${{ steps.get-artifact-name-pi2.outputs.md5_path }} | |
pi2_md5_filename: ${{ steps.get-artifact-name-pi2.outputs.md5_filename }} | |
pi2_sha1_path: ${{ steps.get-artifact-name-pi2.outputs.sha1_path }} | |
pi2_sha1_filename: ${{ steps.get-artifact-name-pi2.outputs.sha1_filename }} | |
pi2_sha256_path: ${{ steps.get-artifact-name-pi2.outputs.sha256_path }} | |
pi2_sha256_filename: ${{ steps.get-artifact-name-pi2.outputs.sha256_filename }} | |
version: ${{ steps.get_version.outputs.version }} | |
builddate: ${{ steps.get_version.outputs.builddate }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- | |
name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- | |
name: Get the version | |
id: get_version | |
run: | | |
raw=$(git branch -r --contains ${{ github.ref }}) | |
branch=${raw/origin\/} | |
echo ::set-output name=version::${VERSION} | |
echo ::set-output name=buildhash::$(git rev-parse --short "$GITHUB_SHA") | |
echo ::set-output name=buildbranch::'crankshaft-ng' | |
echo ::set-output name=builddate::$(date '+%Y-%m-%d') | |
env: | |
version: ${{ github.event.inputs.version }} | |
- | |
name: Configure | |
id: configure | |
run: | | |
cat > config <<EOF | |
IMG_NAME=${IMG_VERSION} | |
ENABLE_SSH=0 | |
#these are the defaults uncomment to change | |
#FIRST_USER_NAME=pi | |
#FIRST_USER_PASS=raspberry | |
# Uncomment this if a build fails and you'd like to try again | |
#CONTINUE=1 | |
IMG_VERSION=${IMG_VERSION} | |
IMG_FILENAME=${IMG_VERSION} | |
ZIP_FILENAME=${IMG_VERSION} | |
BUILDHASH='${BUILDHASH}' | |
BUILDBRANCH='${BUILDBRANCH}' | |
BUILDDATE='${BUILDDATE}' | |
EOF | |
find . -type f -iname "*.sh" -exec chmod +x {} \; | |
cat config | |
env: | |
version: ${{ steps.get_version.outputs.version }} | |
BUILDHASH: ${{ steps.get_version.outputs.buildhash }} | |
BUILDBRANCH: ${{ steps.get_version.outputs.buildbranch }} | |
BUILDDATE: ${{ steps.get_version.outputs.builddate }} | |
IMG_VERSION: '${{ steps.get_version.outputs.builddate }}-${{ steps.get_version.outputs.buildbranch }}-${{ steps.get_version.outputs.buildhash }}' | |
- | |
name: Run build | |
id: build-docker | |
run: bash ./build-docker.sh | |
env: | |
GIT_HASH: ${{ steps.get_version.outputs.buildhash }} | |
GIT_BRANCH: ${{ steps.get_version.outputs.buildbranch }} | |
- | |
name: Get Name of Artifact | |
id: get-artifact-name | |
run: | | |
ls -hla deploy/* | |
ARTIFACT_PATHNAME=$(ls deploy/*[!-pi2].zip | head -n 1) | |
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME) | |
MD5_PATHNAME=$(ls deploy/*[!-pi2].img.md5 | head -n 1) | |
MD5_NAME=$(basename $MD5_PATHNAME) | |
SHA1_PATHNAME=$(ls deploy/*[!-pi2].sha1 | head -n 1) | |
SHA1_NAME=$(basename $SHA1_PATHNAME) | |
SHA256_PATHNAME=$(ls deploy/*[!-pi2].sha256 | head -n 1) | |
SHA256_NAME=$(basename $SHA256_PATHNAME) | |
echo ::set-output name=artifact_filename::${ARTIFACT_NAME} | |
echo ::set-output name=artifact_path::${ARTIFACT_PATHNAME} | |
echo ::set-output name=md5_filename::${MD5_NAME} | |
echo ::set-output name=md5_path::${MD5_PATHNAME} | |
echo ::set-output name=sha1_filename::${SHA1_NAME} | |
echo ::set-output name=sha1_path::${SHA1_PATHNAME} | |
echo ::set-output name=sha256_filename::${SHA256_NAME} | |
echo ::set-output name=sha256_path::${SHA256_PATHNAME} | |
- | |
name: Get Name of Artifact - pi2 | |
id: get-artifact-name-pi2 | |
run: | | |
ls -hla deploy/* | |
ARTIFACT_PATHNAME=$(ls deploy/*[-pi2].zip | head -n 1) | |
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME) | |
MD5_PATHNAME=$(ls deploy/*[-pi2].img.md5 | head -n 1) | |
MD5_NAME=$(basename $MD5_PATHNAME) | |
SHA1_PATHNAME=$(ls deploy/*[-pi2].sha1 | head -n 1) | |
SHA1_NAME=$(basename $SHA1_PATHNAME) | |
SHA256_PATHNAME=$(ls deploy/*[-pi2].sha256 | head -n 1) | |
SHA256_NAME=$(basename $SHA256_PATHNAME) | |
echo ::set-output name=artifact_filename::${ARTIFACT_NAME} | |
echo ::set-output name=artifact_path::${ARTIFACT_PATHNAME} | |
echo ::set-output name=md5_filename::${MD5_NAME} | |
echo ::set-output name=md5_path::${MD5_PATHNAME} | |
echo ::set-output name=sha1_filename::${SHA1_NAME} | |
echo ::set-output name=sha1_path::${SHA1_PATHNAME} | |
echo ::set-output name=sha256_filename::${SHA256_NAME} | |
echo ::set-output name=sha256_path::${SHA256_PATHNAME} | |
- | |
name: Upload build artifacts | |
id: upload_deploy | |
uses: actions/upload-artifact@v4 | |
with: | |
name: deploy | |
path: | | |
${{ steps.get-artifact-name.outputs.artifact_path }} | |
${{ steps.get-artifact-name.outputs.md5_path }} | |
${{ steps.get-artifact-name.outputs.sha1_path }} | |
${{ steps.get-artifact-name.outputs.sha256_path }} | |
${{ steps.get-artifact-name-pi2.outputs.artifact_path }} | |
${{ steps.get-artifact-name-pi2.outputs.md5_path }} | |
${{ steps.get-artifact-name-pi2.outputs.sha1_path }} | |
${{ steps.get-artifact-name-pi2.outputs.sha256_path }} | |
./pi-gen/deploy/build.log | |
release: | |
name: Create release | |
needs: [buildimage] | |
if: | |
contains(github.event.inputs.version,'csng') | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Create GitHub release | |
id: create_release | |
uses: release-drafter/release-drafter@v5 | |
with: | |
version: ${{needs.version.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: deploy | |
- | |
name: Get Name of Artifact | |
id: get-artifact-name | |
run: | | |
ls -hla deploy/* | |
ARTIFACT_PATHNAME=$(ls deploy/*[!-pi2].zip | head -n 1) | |
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME) | |
MD5_PATHNAME=$(ls deploy/*[!-pi2].img.md5 | head -n 1) | |
MD5_NAME=$(basename $MD5_PATHNAME) | |
SHA1_PATHNAME=$(ls deploy/*[!-pi2].sha1 | head -n 1) | |
SHA1_NAME=$(basename $SHA1_PATHNAME) | |
SHA256_PATHNAME=$(ls deploy/*[!-pi2].sha256 | head -n 1) | |
SHA256_NAME=$(basename $SHA256_PATHNAME) | |
echo ::set-output name=artifact_filename::${ARTIFACT_NAME} | |
echo ::set-output name=artifact_path::${ARTIFACT_PATHNAME} | |
echo ::set-output name=md5_filename::${MD5_NAME} | |
echo ::set-output name=md5_path::${MD5_PATHNAME} | |
echo ::set-output name=sha1_filename::${SHA1_NAME} | |
echo ::set-output name=sha1_path::${SHA1_PATHNAME} | |
echo ::set-output name=sha256_filename::${SHA256_NAME} | |
echo ::set-output name=sha256_path::${SHA256_PATHNAME} | |
- | |
name: Get Name of Artifact - pi2 | |
id: get-artifact-name-pi2 | |
run: | | |
ls -hla deploy/* | |
ARTIFACT_PATHNAME=$(ls deploy/*[-pi2].zip | head -n 1) | |
ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME) | |
MD5_PATHNAME=$(ls deploy/*[-pi2].img.md5 | head -n 1) | |
MD5_NAME=$(basename $MD5_PATHNAME) | |
SHA1_PATHNAME=$(ls deploy/*[-pi2].sha1 | head -n 1) | |
SHA1_NAME=$(basename $SHA1_PATHNAME) | |
SHA256_PATHNAME=$(ls deploy/*[-pi2].sha256 | head -n 1) | |
SHA256_NAME=$(basename $SHA256_PATHNAME) | |
echo ::set-output name=artifact_filename::${ARTIFACT_NAME} | |
echo ::set-output name=artifact_path::${ARTIFACT_PATHNAME} | |
echo ::set-output name=md5_filename::${MD5_NAME} | |
echo ::set-output name=md5_path::${MD5_PATHNAME} | |
echo ::set-output name=sha1_filename::${SHA1_NAME} | |
echo ::set-output name=sha1_path::${SHA1_PATHNAME} | |
echo ::set-output name=sha256_filename::${SHA256_NAME} | |
echo ::set-output name=sha256_path::${SHA256_PATHNAME} | |
- | |
name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get-artifact-name.outputs.artifact_path }} | |
asset_name: ${{ steps.get-artifact-name.outputs.artifact_filename }} | |
asset_content_type: application/zip | |
- | |
name: Upload Release Asset -pi2 | |
id: upload-release-asset-pi2 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get-artifact-name-pi2.outputs.artifact_path }} | |
asset_name: ${{ steps.get-artifact-name-pi2.outputs.artifact_filename }} | |
asset_content_type: application/zip | |
- | |
name: Upload Release MD5 | |
id: upload-release-md5 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get-artifact-name.outputs.md5_path }} | |
asset_name: ${{ steps.get-artifact-name.outputs.md5_filename }} | |
asset_content_type: text/plain | |
- | |
name: Upload Release MD5 -pi2 | |
id: upload-release-md5-pi2 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get-artifact-name-pi2.outputs.md5_path }} | |
asset_name: ${{ steps.get-artifact-name-pi2.outputs.md5_filename }} | |
asset_content_type: text/plain | |
- | |
name: Upload Release SHA1 | |
id: upload-release-sha1 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get-artifact-name.outputs.sha1_path }} | |
asset_name: ${{ steps.get-artifact-name.outputs.sha1_filename }} | |
asset_content_type: text/plain | |
- | |
name: Upload Release SHA1 -pi2 | |
id: upload-release-sha1-pi2 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get-artifact-name-pi2.outputs.sha1_path }} | |
asset_name: ${{ steps.get-artifact-name-pi2.outputs.sha1_filename }} | |
asset_content_type: text/plain | |
- | |
name: Upload Release SHA256 | |
id: upload-release-SHA256 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get-artifact-name.outputs.sha256_path }} | |
asset_name: ${{ steps.get-artifact-name.outputs.sha256_filename }} | |
asset_content_type: text/plain | |
- | |
name: Upload Release SHA256 -pi2 | |
id: upload-release-SHA256-pi2 | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: ${{ steps.get-artifact-name-pi2.outputs.sha256_path }} | |
asset_name: ${{ steps.get-artifact-name-pi2.outputs.sha256_filename }} | |
asset_content_type: text/plain |