From 39267c40814c20e6b45754141d2f1bf09b4c76db Mon Sep 17 00:00:00 2001 From: Jeff Dickey <216188+jdx@users.noreply.github.com> Date: Sat, 25 May 2024 08:51:50 -0500 Subject: [PATCH] chore: conditionally set sccache token --- .github/workflows/release.yml | 8 ++++++-- .github/workflows/test.yml | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 09826518f..64b83f59b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,8 +25,8 @@ jobs: SCCACHE_BUCKET: sccache SCCACHE_REGION: auto SCCACHE_S3_NO_CREDENTIALS: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID && '0' || '1' }} - AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }} + MINIO_AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }} + MINIO_AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }} strategy: fail-fast: false matrix: @@ -82,6 +82,10 @@ jobs: p12-file-base64: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12 }} p12-password: ${{ secrets.APPLE_DEVELOPER_ID_APPLICATION_CERTS_P12_PASS }} - uses: actions/checkout@v4 + - if: ${{ env.SCCACHE_S3_NO_CREDENTIALS == '0' }} + run: | + echo AWS_ACCESS_KEY_ID=$MINIO_AWS_ACCESS_KEY_ID >> $GITHUB_ENV + echo AWS_SECRET_ACCESS_KEY=$MINIO_AWS_SECRET_ACCESS_KEY >> $GITHUB_ENV - uses: mozilla-actions/sccache-action@v0.0.4 - name: cache crates id: cache-crates diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0ab919836..4c204a9c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,9 +21,9 @@ env: SCCACHE_ENDPOINT: minio.jdx.dev SCCACHE_BUCKET: sccache SCCACHE_REGION: auto - SCCACHE_S3_NO_CREDENTIALS: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID && '0' || '1' }} - AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }} + SCCACHE_S3_NO_CREDENTIALS: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID && '1' || '0' }} + MINIO_AWS_ACCESS_KEY_ID: ${{ secrets.MINIO_AWS_ACCESS_KEY_ID }} + MINIO_AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_AWS_SECRET_ACCESS_KEY }} permissions: pull-requests: write @@ -39,6 +39,10 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.RTX_GITHUB_BOT_TOKEN || github.token }} + - if: ${{ env.SCCACHE_S3_NO_CREDENTIALS == '0' }} + run: | + echo AWS_ACCESS_KEY_ID=$MINIO_AWS_ACCESS_KEY_ID >> $GITHUB_ENV + echo AWS_SECRET_ACCESS_KEY=$MINIO_AWS_SECRET_ACCESS_KEY >> $GITHUB_ENV - uses: mozilla-actions/sccache-action@v0.0.4 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: { toolchain: stable, components: rustfmt } @@ -86,6 +90,10 @@ jobs: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.event.pull_request.head.ref }} token: ${{ secrets.RTX_GITHUB_BOT_TOKEN || github.token }} + - if: ${{ env.SCCACHE_S3_NO_CREDENTIALS == '0' }} + run: | + echo AWS_ACCESS_KEY_ID=$MINIO_AWS_ACCESS_KEY_ID >> $GITHUB_ENV + echo AWS_SECRET_ACCESS_KEY=$MINIO_AWS_SECRET_ACCESS_KEY >> $GITHUB_ENV - uses: mozilla-actions/sccache-action@v0.0.4 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: @@ -126,6 +134,10 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - if: ${{ env.SCCACHE_S3_NO_CREDENTIALS == '0' }} + run: | + echo AWS_ACCESS_KEY_ID=$MINIO_AWS_ACCESS_KEY_ID >> $GITHUB_ENV + echo AWS_SECRET_ACCESS_KEY=$MINIO_AWS_SECRET_ACCESS_KEY >> $GITHUB_ENV - uses: mozilla-actions/sccache-action@v0.0.4 - uses: Swatinem/rust-cache@v2 with: