Skip to content

Weekly Scheduled

Weekly Scheduled #28

name: "Weekly Scheduled"
on:
schedule:
- cron: '*/5 * * * *'
jobs:
check-run:
name: Check If Weekly Test Build should be built
if: ${{ vars.ENABLED_WEEKLY == 1 }}
runs-on: ubuntu-latest
outputs:
runs-count: ${{ steps.get-info.outputs.runs-count }}
steps:
- name: Get previous builds info
id: get-info
shell: bash
run: |
echo ${{ github.token }} | gh auth login --with-token
WORKFLOW_ID=$(gh api -X GET /repos/${{ github.repository }}/actions/runs/${{ github.run_id }} --jq='.workflow_id')
TOTAL_COUNT=$(gh api -X GET "/repos/${{ github.repository }}/actions/workflows/${WORKFLOW_ID}/runs?status=success&per_page=1&head_sha=${{ github.sha }}" --jq '.total_count')
echo "Runs success count: ${TOTAL_COUNT}"
if (( $TOTAL_COUNT == 0 )); then
TOTAL_COUNT=$(gh api -X GET "/repos/${{ github.repository }}/actions/workflows/${WORKFLOW_ID}/runs?status=in_progress&per_page=1&head_sha=${{ github.sha }}" --jq '.total_count')
echo "Runs in progress count: ${TOTAL_COUNT}"
fi
echo "runs-count=${TOTAL_COUNT}" >> "$GITHUB_OUTPUT"
macos:
needs: check-run
if: ${{ needs.check-run.outputs.runs-count == 0 }}
uses: ./.github/workflows/_build-macos.yml
with:
os: 'macos-13'
weekly-deploy: true
windows:
needs: check-run
if: ${{ needs.check-run.outputs.runs-count == 0 }}
uses: ./.github/workflows/_build-windows.yml
with:
weekly-deploy: true
windows-msvs:
needs: check-run
if: ${{ needs.check-run.outputs.runs-count == 0 }}
uses: ./.github/workflows/_build-windows.yml
with:
weekly-deploy: true
merge-binaries-to-sf:
name: Merge binaries
runs-on: ubuntu-latest
needs: [macos, windows, windows-msvs]
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
sparse-checkout: .github
- name: Decrypt deploy SSH key
run: bash .github/pre-deploy.sh
env:
DEPLOY_SSH_PASSWORD: ${{ secrets.DEPLOY_SSH_PASSWORD }}
- name: Validate upload target
run: scp -vv -o ServerAliveCountMax=2 -o ServerAliveInterval=300 -o ConnectTimeout=120 -o ConnectionAttempts=5 .github/workflows/build_weekly_scheduled.yml [email protected]:/dev/null
- name: Download artifacts
uses: actions/download-artifact@v4
with:
pattern: weekly-artifacts-*
merge-multiple: true
- name: Check artifacts
run: ls -l .
- name: Get version
id: get-version
run: TZ=UTC0 git show $${{ github.sha }} --format="short-version=%cd.%h" --quiet --date='format-local:%Y-%m-%d' --abbrev=7 >> "$GITHUB_OUTPUT"
- name: Toot
run: |
curl -X POST \
-H "Authorization: Bearer ${{ secrets.MASTODON_ACCESS_TOKEN }}" \
-H "Idempotency-Key: ${{ github.sha }}" \
--data-raw 'status=@[email protected] Test Build ${{ steps.get-version.outputs.short-version }}' \
-d 'visibility=direct' \
-d 'language=en' \
https://fosstodon.org/api/v1/statuses