From 19d07ba26492cddfbdd49420810bbfdced04480f Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 21:13:29 +1000 Subject: [PATCH 01/10] Initial attempt at proto update automation --- .github/workflows/update-protobufs.yaml | 37 +++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/update-protobufs.yaml diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml new file mode 100644 index 000000000..32414af22 --- /dev/null +++ b/.github/workflows/update-protobufs.yaml @@ -0,0 +1,37 @@ +name: Update Dependencies +on: + push: + branches: + - yaakov/auto-protos # temporary trigger during development + schedule: + - cron: '0 17 * * SUN' + +jobs: + update-protobufs: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + submodules: true + + - name: Fetch latest protobufs + run: | + git submodule foreach git pull origin master + + - name: Regenerate C# Code + shell: pwsh + run: | + Resources/ProtobufGen/generate-all.ps1 + + # TODO: We need a new GitHub Machine Account (or maybe an existing one?) to generate a PAT that we can use as the token here + # otherwise, our new changes will not trigger further Actions (on:push or on:pull_request, i.e. CI/CD builds). + #- name: Create Pull Request + # uses: peter-evans/create-pull-request@v3.10.1 + # with: + # token: ${{ secrets.PAT }} + # commit-message: Update protobufs + # title: Update protobufs + # body: | + # - Update protobufs + # branch: auto/protobufs \ No newline at end of file From 10af2eaaf3ef519bebf815169ba2921f1e71cc3c Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 21:14:22 +1000 Subject: [PATCH 02/10] fix options syntax --- .github/workflows/update-protobufs.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml index 32414af22..6023495fd 100644 --- a/.github/workflows/update-protobufs.yaml +++ b/.github/workflows/update-protobufs.yaml @@ -13,7 +13,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2.3.4 - submodules: true + with: + submodules: true - name: Fetch latest protobufs run: | From c0f49cd3288058ea23d6753529bf486c9a5b0143 Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 21:17:02 +1000 Subject: [PATCH 03/10] tweaks to submodule fetching --- .github/workflows/update-protobufs.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml index 6023495fd..162756dec 100644 --- a/.github/workflows/update-protobufs.yaml +++ b/.github/workflows/update-protobufs.yaml @@ -13,12 +13,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2.3.4 - with: - submodules: true - name: Fetch latest protobufs run: | - git submodule foreach git pull origin master + git config pull.ff only + git submodule update --init --recursive + ( cd Resources/Protobufs && git pull origin master ) - name: Regenerate C# Code shell: pwsh From 356464fb0b858db651dce6aaa4b19f57fca558ed Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 21:17:27 +1000 Subject: [PATCH 04/10] rename action --- .github/workflows/update-protobufs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml index 162756dec..a882c7d45 100644 --- a/.github/workflows/update-protobufs.yaml +++ b/.github/workflows/update-protobufs.yaml @@ -1,4 +1,4 @@ -name: Update Dependencies +name: Update Protobufs on: push: branches: From a73b51e274161a1850d3154064c7eac90c055a4b Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 21:20:26 +1000 Subject: [PATCH 05/10] Fix casing in regen script --- Resources/ProtobufGen/generate-all.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/ProtobufGen/generate-all.ps1 b/Resources/ProtobufGen/generate-all.ps1 index daa8b1b96..7aa9f3be1 100644 --- a/Resources/ProtobufGen/generate-all.ps1 +++ b/Resources/ProtobufGen/generate-all.ps1 @@ -13,7 +13,7 @@ param([string[]]$ProtoDir) $ProtoGenSrc = Join-Path $PSScriptRoot 'ProtobufGen' $ProtoGenDll = Join-Path $ProtoGenSrc '\bin\Debug\ProtobufGen.dll' -$ProtoBase = Join-Path $PSScriptRoot '..\ProtoBufs' +$ProtoBase = Join-Path $PSScriptRoot '..\Protobufs' $SK2Base = Join-Path $PSScriptRoot '..\..\SteamKit2\SteamKit2\Base\Generated' & dotnet build --configuration Debug $ProtoGenSrc From 2d5df933464c9d66eba87e18c558f9dd9f4b9444 Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 21:23:57 +1000 Subject: [PATCH 06/10] Create PR when run --- .github/workflows/update-protobufs.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml index a882c7d45..e50ec97ec 100644 --- a/.github/workflows/update-protobufs.yaml +++ b/.github/workflows/update-protobufs.yaml @@ -27,12 +27,12 @@ jobs: # TODO: We need a new GitHub Machine Account (or maybe an existing one?) to generate a PAT that we can use as the token here # otherwise, our new changes will not trigger further Actions (on:push or on:pull_request, i.e. CI/CD builds). - #- name: Create Pull Request - # uses: peter-evans/create-pull-request@v3.10.1 - # with: - # token: ${{ secrets.PAT }} - # commit-message: Update protobufs - # title: Update protobufs - # body: | - # - Update protobufs - # branch: auto/protobufs \ No newline at end of file + - name: Create Pull Request + uses: peter-evans/create-pull-request@v3.10.1 + with: + #token: ${{ secrets.PAT }} + commit-message: Update protobufs + title: Update protobufs + body: | + - Update protobufs + branch: auto/protobufs \ No newline at end of file From a6d898644a5d02c7e152de07a260db394bd230e1 Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 21:26:40 +1000 Subject: [PATCH 07/10] disable side effects pending discussion --- .github/workflows/update-protobufs.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml index e50ec97ec..f306d45f5 100644 --- a/.github/workflows/update-protobufs.yaml +++ b/.github/workflows/update-protobufs.yaml @@ -3,8 +3,8 @@ on: push: branches: - yaakov/auto-protos # temporary trigger during development - schedule: - - cron: '0 17 * * SUN' + #schedule: + #- cron: '0 17 * * SUN' jobs: update-protobufs: @@ -27,12 +27,12 @@ jobs: # TODO: We need a new GitHub Machine Account (or maybe an existing one?) to generate a PAT that we can use as the token here # otherwise, our new changes will not trigger further Actions (on:push or on:pull_request, i.e. CI/CD builds). - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3.10.1 - with: - #token: ${{ secrets.PAT }} - commit-message: Update protobufs - title: Update protobufs - body: | - - Update protobufs - branch: auto/protobufs \ No newline at end of file + #- name: Create Pull Request + # uses: peter-evans/create-pull-request@v3.10.1 + # with: + # #token: ${{ secrets.PAT }} + # commit-message: Update protobufs + # title: Update protobufs + # body: | + # - Update protobufs + # branch: auto/protobufs \ No newline at end of file From 79ea12c4fb92b53b9806fd1678f84c4dde248ac8 Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 21:57:45 +1000 Subject: [PATCH 08/10] Simplify --- .github/workflows/update-protobufs.yaml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml index f306d45f5..371ae5b39 100644 --- a/.github/workflows/update-protobufs.yaml +++ b/.github/workflows/update-protobufs.yaml @@ -14,16 +14,10 @@ jobs: - name: Checkout uses: actions/checkout@v2.3.4 - - name: Fetch latest protobufs - run: | - git config pull.ff only - git submodule update --init --recursive - ( cd Resources/Protobufs && git pull origin master ) - - - name: Regenerate C# Code + - name: Run Update Script shell: pwsh run: | - Resources/ProtobufGen/generate-all.ps1 + Resources/ProtobufGen/update.ps1 # TODO: We need a new GitHub Machine Account (or maybe an existing one?) to generate a PAT that we can use as the token here # otherwise, our new changes will not trigger further Actions (on:push or on:pull_request, i.e. CI/CD builds). From 8c60dc5b5d871d9e0cdca61a791db1c5f3abdd64 Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 2 Oct 2021 22:01:26 +1000 Subject: [PATCH 09/10] try init'ing submodules first --- .github/workflows/update-protobufs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml index 371ae5b39..957ae5e01 100644 --- a/.github/workflows/update-protobufs.yaml +++ b/.github/workflows/update-protobufs.yaml @@ -17,6 +17,7 @@ jobs: - name: Run Update Script shell: pwsh run: | + git submodule init Resources/ProtobufGen/update.ps1 # TODO: We need a new GitHub Machine Account (or maybe an existing one?) to generate a PAT that we can use as the token here From 1f6922590596eb06262abb69167c599895830ae9 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 26 Aug 2024 22:38:45 +0300 Subject: [PATCH 10/10] Update update-protobufs.yaml --- .github/workflows/update-protobufs.yaml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-protobufs.yaml b/.github/workflows/update-protobufs.yaml index 957ae5e01..158217344 100644 --- a/.github/workflows/update-protobufs.yaml +++ b/.github/workflows/update-protobufs.yaml @@ -1,11 +1,17 @@ name: Update Protobufs + on: + workflow_dispatch: push: branches: - yaakov/auto-protos # temporary trigger during development #schedule: #- cron: '0 17 * * SUN' +permissions: + contents: write + pull-requests: write + jobs: update-protobufs: runs-on: ubuntu-latest @@ -13,21 +19,21 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2.3.4 + with: + submodules: true - - name: Run Update Script + - name: Run update script shell: pwsh - run: | - git submodule init - Resources/ProtobufGen/update.ps1 + run: Resources/ProtobufGen/update.ps1 # TODO: We need a new GitHub Machine Account (or maybe an existing one?) to generate a PAT that we can use as the token here # otherwise, our new changes will not trigger further Actions (on:push or on:pull_request, i.e. CI/CD builds). #- name: Create Pull Request - # uses: peter-evans/create-pull-request@v3.10.1 + # uses: peter-evans/create-pull-request@v6 # with: # #token: ${{ secrets.PAT }} # commit-message: Update protobufs # title: Update protobufs # body: | # - Update protobufs - # branch: auto/protobufs \ No newline at end of file + # branch: auto/protobufs