Skip to content

Commit

Permalink
ci: move snapshots and dependency submission to daily workflow (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
sargunv authored Dec 26, 2024
1 parent f0e50e3 commit 82a287b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 36 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,42 +99,6 @@ jobs:
name: "demo-app-debug"
path: "demo-app/build/outputs/apk/debug/demo-app-debug.apk"

publish-snapshot:
needs:
- "test-android"
- "test-ios"
if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}"
runs-on: "macos-latest"
permissions:
packages: "write"
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
- uses: "./.github/actions/setup"
- run: "./gradlew publishAllPublicationsToGitHubPackagesRepository"
env:
ORG_GRADLE_PROJECT_githubToken: "${{ secrets.GITHUB_TOKEN }}"
ORG_GRADLE_PROJECT_githubUser: "${{ github.actor }}"

dependency-submission:
if: "${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}"
runs-on: "ubuntu-latest"
permissions:
contents: "write"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-java@v4"
with:
distribution: "temurin"
java-version: 23
- uses: "gradle/actions/dependency-submission@v4"
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"
- uses: "advanced-security/[email protected]"

all-good:
needs:
- "check-format"
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
name: "Daily"

on:
schedule:
- cron: "00 10 * * *"

jobs:
check-last-run:
runs-on: "ubuntu-latest"
steps:
- uses: "octokit/[email protected]"
id: "check-last-run"
with:
route: "GET /repos/${{github.repository}}/actions/workflows/daily.yml/runs?per_page=1&status=completed"
outputs:
last_sha: "${{ fromJson(steps.check-last-run.outputs.data).workflow_runs[0].head_sha }}"

publish-snapshot:
needs: ["check-last-run"]
if: "${{ needs.check-last-run.outputs.last_sha != github.sha }}"
runs-on: "macos-latest"
permissions:
packages: "write"
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0
- uses: "./.github/actions/setup"
- run: "./gradlew publishAllPublicationsToGitHubPackagesRepository"
env:
ORG_GRADLE_PROJECT_githubToken: "${{ secrets.GITHUB_TOKEN }}"
ORG_GRADLE_PROJECT_githubUser: "${{ github.actor }}"

dependency-submission:
needs: ["check-last-run"]
if: "${{ needs.check-last-run.outputs.last_sha != github.sha }}"
runs-on: "ubuntu-latest"
permissions:
contents: "write"
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-java@v4"
with:
distribution: "temurin"
java-version: 23
- uses: "gradle/actions/dependency-submission@v4"
with:
build-scan-publish: true
build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use"
build-scan-terms-of-use-agree: "yes"
- uses: "advanced-security/[email protected]"

0 comments on commit 82a287b

Please sign in to comment.