Enable bt radio #27
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 | |
- rg-dev | |
- rg-release | |
jobs: | |
build: | |
runs-on: "${{ vars.RUNS_ON || 'ubuntu-22.04' }}" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Prepare docker output | |
run: | | |
touch output.env | |
- 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 -E ./build-docker.sh -v ${{ github.workspace }}/output.env:/output.env | |
env: | |
FIRST_USER_NAME: ${{ vars.FIRST_USER_NAME }} | |
FIRST_USER_PASS: ${{ vars.FIRST_USER_PASS }} | |
- name: Load and export docker output | |
run: | | |
while IFS='=' read -r key value; do | |
echo "Processing $key with value $value" | |
echo "$key=$value" >> $GITHUB_ENV | |
done < output.env | |
echo "All variables from output.env have been added to GITHUB_ENV." | |
- name: Generate checksum | |
id: generate-checksum | |
run: | | |
cd deploy; for file in *.zip; do sha256sum --binary $file | sudo tee "${file}.sha256"; done; cd ../ | |
- name: Get current date | |
id: date | |
run: echo "date=$(date -u +'%Y%m%d')" >> $GITHUB_ENV | |
- name: Set nightly artifact name | |
id: set-nightly-artifact-name | |
run: echo "ARTIFACT_NAME=wlanpi-nightly-${{ env.version }}~gha${{ env.date }}" >> $GITHUB_ENV | |
- name: Upload image | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: deploy/*.zip | |
- name: Upload zipped image checksum | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }}-sha256 | |
path: deploy/*.sha256 | |
- name: Upload image info | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }}-info | |
path: deploy/*.info | |
- name: Create pre-release from default branch | |
if: ${{ github.event.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event.ref == format('refs/heads/{0}', 'rg-release') }} | |
uses: "joshschmelzle/action-automatic-releases@1c60c2dcfeb5382b81099310bdb4a376dc7753a0" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: ${{ env.version }} | |
prerelease: true | |
files: | | |
deploy/*.zip | |
deploy/*.info | |
deploy/rg-wlanpi-os/os.json | |
deploy/*.sha256 | |
- name: Upload logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.ARTIFACT_NAME }}-buildlogs | |
path: deploy/*.log | |
- name: Chown the dir for next time | |
if: always() | |
run: | | |
sudo chown -R ubuntu:ubuntu ./* | |
slack-workflow-status: | |
if: ${{ always() && (github.repository_owner == 'WLAN-Pi') && (! github.event.pull_request.head.repo.fork) }} | |
name: Post Workflow Status to WLAN-Pi Slack | |
needs: | |
- build | |
runs-on: "${{ vars.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 }} |