From 82a287b29cdbf26ea51d2c39b143a785969270c2 Mon Sep 17 00:00:00 2001 From: Sargun Vohra Date: Wed, 25 Dec 2024 16:38:15 -0800 Subject: [PATCH] ci: move snapshots and dependency submission to daily workflow (#190) --- .github/workflows/ci.yml | 36 ------------------------- .github/workflows/daily.yml | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/daily.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e3a60f4..30340c9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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/cocoapods-dependency-submission-action@v1.1" - all-good: needs: - "check-format" diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml new file mode 100644 index 00000000..6f593eaa --- /dev/null +++ b/.github/workflows/daily.yml @@ -0,0 +1,52 @@ +--- +name: "Daily" + +on: + schedule: + - cron: "00 10 * * *" + +jobs: + check-last-run: + runs-on: "ubuntu-latest" + steps: + - uses: "octokit/request-action@v2.x" + 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/cocoapods-dependency-submission-action@v1.1"