-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish development builds using GitHub Action (#2)
* Revert "Disable the GitHub Action" This reverts commit 5c71411. * Publish development builds using GitHub Actions * store cache to speed up builds
- Loading branch information
Showing
1 changed file
with
156 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
name: Build & Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
publish-dev-build: | ||
type: boolean | ||
description: Publish development build to GitHub Releases | ||
|
||
jobs: | ||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: [ "pi0", "pi2", "pi02w", "pi4" ] | ||
steps: | ||
- name: checkout seedsigner-os | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: "LumenSigner/seedsigner-os" | ||
submodules: true | ||
path: "seedsigner-os" | ||
|
||
- name: get seedsigner-os latest commit hash | ||
id: get-seedsigner-os-hash | ||
run: | | ||
cd seedsigner-os | ||
echo "builder_hash=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | ||
- name: checkout source | ||
uses: actions/checkout@v3 | ||
with: | ||
path: "seedsigner-os/opt/rootfs-overlay/opt" | ||
|
||
- name: get lumensigner latest commit hash | ||
id: get-lumensigner-hash | ||
run: | | ||
git init | ||
echo "source_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | ||
- name: delete unnecessary files | ||
run: | | ||
cd seedsigner-os/opt/rootfs-overlay/opt | ||
find . -mindepth 1 -maxdepth 1 ! -name src -exec rm -rf {} + | ||
ls -la . | ||
ls -la src | ||
- name: restore build cache | ||
id: build-cache-restore | ||
uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/.buildroot-ccache/ | ||
key: build-cache-${{ matrix.target }}-${{ env.builder_hash }} | ||
# restore-keys: | | ||
# build-cache-${{ matrix.target }}- | ||
|
||
- name: build | ||
run: | | ||
cd seedsigner-os/opt | ||
./build.sh --${{ matrix.target }} --skip-repo --no-clean | ||
- name: save build cache | ||
id: build-cache-save | ||
uses: actions/cache/save@v3 | ||
with: | ||
path: | | ||
~/.buildroot-ccache/ | ||
key: build-cache-${{ matrix.target }}-${{ env.builder_hash }} | ||
|
||
- name: list image (before rename) | ||
run: | | ||
cd seedsigner-os/images | ||
ls -la | ||
- name: rename image | ||
run: | | ||
cd seedsigner-os/images | ||
mv seedsigner_os*.img lumensigner_os.${{ env.source_hash }}.${{ matrix.target }}.img | ||
- name: print sha256sum | ||
run: | | ||
cd seedsigner-os/images | ||
sha256sum *.img | ||
- name: list image (after rename) | ||
run: | | ||
cd seedsigner-os/images | ||
ls -la | ||
- name: upload images | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: lumensigner_os_images | ||
path: "seedsigner-os/images/*.img" | ||
if-no-files-found: error | ||
|
||
sha256sum: | ||
name: calculate sha256sum | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- name: download images | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: lumensigner_os_images | ||
path: images | ||
|
||
- name: list images | ||
run: | | ||
cd images | ||
ls -la | ||
- name: get lumensigner latest commit hash | ||
id: get-lumensigner-hash | ||
run: | | ||
git init | ||
echo "source_hash=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV | ||
- name: write sha256sum | ||
run: | | ||
cd images | ||
sha256sum *.img > lumensigner_os.${{ env.source_hash }}.img.sha256sum | ||
- name: upload checksums | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: lumensigner_os_images | ||
path: "images/*.sha256sum" | ||
if-no-files-found: error | ||
|
||
publish: | ||
name: publish | ||
runs-on: ubuntu-latest | ||
needs: sha256sum | ||
if: ${{ github.event.inputs.publish-dev-build }} | ||
permissions: | ||
contents: "write" | ||
packages: "write" | ||
steps: | ||
- name: download images | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: lumensigner_os_images | ||
path: images | ||
- uses: marvinpinto/action-automatic-releases@latest | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: "latest-dev-build" | ||
prerelease: true | ||
title: "Development Build" | ||
files: | | ||
images/*.img | ||
images/*.sha256sum |