Daily builds #393
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: Daily builds | |
on: | |
schedule: | |
- cron: '00 18 * * *' | |
workflow_dispatch: | |
jobs: | |
check_for_commits: | |
runs-on: | |
group: "Canonical self-hosted runners" | |
labels: | |
- self-hosted | |
- linux | |
- jammy | |
- large | |
- X64 | |
name: Check for commits | |
outputs: | |
new_commit_count: ${{ steps.commit_check.outputs.new_commit_count }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Check for commits | |
id: commit_check | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# get the last daily build that passed by | |
# 1. getting all workflows that are daily builds (path == ...) | |
# 2. removing those that did not result in success | |
# 3. selecting the date/time they started at (format: %Y-%m-%dT%H:%M:%sZ) | |
# 4. removing the Z postfix from the date to make it usable by git directly | |
export LAST_PASS_DAILY_BUILD=`gh api repos/canonical/checkbox/actions/runs --paginate --jq '.workflow_runs[] | select(.path == ".github/workflows/daily-builds.yml") | select(.conclusion == "success") | .run_started_at | .[:-1]' | head -1` | |
commit_count=$(git log --since="$LAST_PASS_DAILY_BUILD" --oneline -- checkbox-ng checkbox-support providers checkbox-core-snap checkbox-snap | wc -l) | |
echo "new_commit_count=$commit_count" | tee $GITHUB_OUTPUT | |
snapcraft7-runtime: | |
needs: check_for_commits | |
if: ${{ needs.check_for_commits.outputs.new_commit_count > 0 || github.event_name == 'workflow_dispatch' }} | |
uses: ./.github/workflows/checkbox-core-snap-daily-builds.yml | |
secrets: inherit | |
snapcraft7-frontend: | |
needs: check_for_commits | |
if: ${{ needs.check_for_commits.outputs.new_commit_count > 0 || github.event_name == 'workflow_dispatch' }} | |
uses: ./.github/workflows/checkbox-snap-daily-builds.yml | |
secrets: inherit | |
deb-daily: | |
needs: check_for_commits | |
if: ${{ needs.check_for_commits.outputs.new_commit_count > 0 || github.event_name == 'workflow_dispatch' }} | |
uses: ./.github/workflows/deb-daily-builds.yml | |
secrets: inherit | |
snapcraft8-daily: | |
needs: check_for_commits | |
if: ${{ needs.check_for_commits.outputs.new_commit_count > 0 || github.event_name == 'workflow_dispatch' }} | |
uses: ./.github/workflows/snapcraft8_builds.yaml | |
secrets: inherit |