From 4311d7f1f4387573bce637e9ded4bdce6935c4e9 Mon Sep 17 00:00:00 2001 From: Ikiru Yoshizaki <3856350+guitarrapc@users.noreply.github.com> Date: Wed, 17 Apr 2024 15:38:33 +0900 Subject: [PATCH] feat: change load secret from op --- .github/workflows/build-canary.yml | 10 +++++++++- .github/workflows/build-debug.yml | 19 +++++++++++++++---- .github/workflows/build-release.yml | 17 ++++++++++++++--- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-canary.yml b/.github/workflows/build-canary.yml index b1875fc28..a570015b0 100644 --- a/.github/workflows/build-canary.yml +++ b/.github/workflows/build-canary.yml @@ -42,10 +42,18 @@ jobs: env: NUGET_CREDENTIALPROVIDER_SESSIONTOKENCACHE_ENABLED: true steps: + - name: Load secrets + id: op-load-secret + uses: 1password/load-secrets-action@v2 + with: + export-env: false + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }} + VSS_NUGET_EXTERNAL_FEED_ENDPOINTS_PUBLIC_CANARY: "op://GitHubActionsPublic/VSS_NUGET_EXTERNAL_FEED_ENDPOINTS_PUBLIC_CANARY/credential" - uses: actions/download-artifact@v2 # Upload to NuGet - run: echo "VSS_NUGET_EXTERNAL_FEED_ENDPOINTS=${FEED_ENDPOINTS}" >> $GITHUB_ENV env: - FEED_ENDPOINTS: ${{ secrets.VSS_NUGET_EXTERNAL_FEED_ENDPOINTS_PUBLIC_CANARY }} + FEED_ENDPOINTS: ${{ steps.op-load-secret.outputs.VSS_NUGET_EXTERNAL_FEED_ENDPOINTS_PUBLIC_CANARY }} - run: wget -qO- https://raw.githubusercontent.com/Microsoft/artifacts-credprovider/master/helpers/installcredprovider.sh | bash - run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://pkgs.dev.azure.com/cysharp/Public/_packaging/Canary-Build/nuget/v2 -k AzureDevOps diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml index 728faaea3..eeba2d4af 100644 --- a/.github/workflows/build-debug.yml +++ b/.github/workflows/build-debug.yml @@ -43,13 +43,24 @@ jobs: build-unity: name: "Build Unity package" - if: "((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:'))" + if: ${{ (github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:') }} strategy: matrix: unity: ["2021.3.0f1"] runs-on: ubuntu-latest timeout-minutes: 15 steps: + - name: Load secrets + id: op-load-secret + uses: 1password/load-secrets-action@v2 + with: + export-env: false + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }} + UNITY_EMAIL: "op://GitHubActionsPublic/UNITY_LICENSE/username" + UNITY_PASSWORD: "op://GitHubActionsPublic/UNITY_LICENSE/credential" + UNITY_SERIAL: "op://GitHubActionsPublic/UNITY_LICENSE/serial" + - uses: actions/checkout@v3 # todo: prepare runtime unit test @@ -65,9 +76,9 @@ jobs: - name: Build Unity (.unitypacakge) uses: Cysharp/Actions/.github/actions/unity-builder@main env: - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} + UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }} with: projectPath: src/MagicOnion.Client.Unity unityVersion: ${{ matrix.unity }} diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 93030b3ff..ef4a76d46 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -50,6 +50,17 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 steps: + - name: Load secrets + id: op-load-secret + uses: 1password/load-secrets-action@v2 + with: + export-env: false + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_PUBLIC }} + UNITY_EMAIL: "op://GitHubActionsPublic/UNITY_LICENSE/username" + UNITY_PASSWORD: "op://GitHubActionsPublic/UNITY_LICENSE/credential" + UNITY_SERIAL: "op://GitHubActionsPublic/UNITY_LICENSE/serial" + - uses: actions/checkout@v3 with: ref: ${{ needs.update-packagejson.outputs.sha }} @@ -58,9 +69,9 @@ jobs: - name: Build Unity (.unitypacakge) uses: Cysharp/Actions/.github/actions/unity-builder@main env: - UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} + UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }} + UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }} UNITY_PACKAGE_VERSION: ${{ inputs.tag }} with: projectPath: src/MagicOnion.Client.Unity