Build image #1375
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 image | |
on: | |
# Allow manual runs of workflow from Actions tab | |
workflow_dispatch: | |
inputs: | |
version-bump: | |
description: Version bump | |
required: true | |
type: choice | |
options: | |
- Auto | |
- Major | |
- Minor | |
- Patch | |
- RC | |
- Dev | |
- Release | |
default: Auto | |
# schedule: | |
# - cron: '37 5 * * *' | |
push: | |
branches: | |
- force-build | |
jobs: | |
build: | |
runs-on: 'ubuntu-22.04' | |
steps: | |
- name: Free Disk Space (Ubuntu) | |
uses: jlumbroso/free-disk-space@main | |
with: | |
# this might remove tools that are actually needed, | |
# if set to "true" but frees about 6 GB | |
tool-cache: false | |
# all of these default to true, but feel free to set to | |
# "false" if necessary for your workflow | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- name: Build image | |
id: build-image | |
run: | | |
last_commit_date=$(git log -1 --format=%cd --date=unix) | |
last_day=$(date -d '-1 day' +%s) | |
if [ "${last_commit_date}" -lt "${last_day}" ]; then | |
echo "Nothig new to build." | |
echo "Last commit:" | |
git log -1 --format='%C(auto)%h (%cd) - %s' --date=relative | |
exit 0 | |
fi | |
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
sudo ./build-docker.sh -v ${{ github.event.inputs.version-bump }} | |
- name: Upload image | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wlanpi-nightly-release-${{ steps.build-image.outputs.version }} | |
path: deploy/*.zip | |
- name: Upload image info | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wlanpi-nightly-release-${{ steps.build-image.outputs.version }}-info | |
path: deploy/*.info | |
- name: Create Pre-Release | |
if: ${{ github.event.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: ${{ steps.build-image.outputs.version }} | |
prerelease: true | |
files: | | |
deploy/*.zip | |
deploy/*.info | |
deploy/wlanpi-os/os.json | |
- name: Upload logs | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wlanpi-nightly-release-${{ steps.build-image.outputs.version }}-buildlogs | |
path: deploy/*.log | |
slack-workflow-status: | |
if: always() | |
name: Post Workflow Status to Slack | |
needs: | |
- build | |
runs-on: 'ubuntu-22.04' | |
steps: | |
- name: Slack Workflow Notification | |
uses: Gamesight/slack-workflow-status@master | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }} | |
channel: '#pi-gen' | |
name: 'WLAN Pi CI Bot' |