From 58f2e0bcb1e034cdd0ef9d9d7428acab82182940 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Fri, 22 Mar 2024 15:23:05 -0700 Subject: [PATCH 1/7] setup some shared setup to use in fortio/ --- .github/actions/common_setup.yml | 16 ++++++++++++++++ .github/workflows/releaser.yml | 14 ++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 .github/actions/common_setup.yml diff --git a/.github/actions/common_setup.yml b/.github/actions/common_setup.yml new file mode 100644 index 0000000..87cf921 --- /dev/null +++ b/.github/actions/common_setup.yml @@ -0,0 +1,16 @@ +name: 'Common Setup' +description: 'Common setup steps for build related workflows' +runs: + using: 'composite' + steps: + - name: Checkout + uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # pin@v3 + with: + fetch-depth: 0 + - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # pin@v1 + - uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # pin@v1 + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 39e9eba..f2955dd 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -28,22 +28,16 @@ jobs: # The type of runner that the job will run on runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # pin@v3 + - name: Common Setup + uses: ./.github/actions/common_setup.yml with: - fetch-depth: 0 - - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # pin@v1 - - uses: docker/setup-buildx-action@2b51285047da1547ffb1b2203d8be4c0af6b1f20 # pin@v1 + DOCKER_USER: ${{ secrets.DOCKER_USER }} + DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} - name: Set up Go uses: actions/setup-go@v5 # pin@v3 with: go-version: '1.21' check-latest: true - - name: Log in to Docker Hub - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # pin@v2 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_TOKEN }} - name: Download goreleaser config run: curl -fsS -o .goreleaser.yaml https://raw.githubusercontent.com/fortio/workflows/main/goreleaser.yaml - name: "GoReleaser Action" From 7cb3a2364e6a48e99f1da18227c8856be99e77a2 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Fri, 22 Mar 2024 15:30:41 -0700 Subject: [PATCH 2/7] trying again to get something reusable --- .github/actions/{ => common_setup}/common_setup.yml | 0 .github/workflows/releaser.yml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/actions/{ => common_setup}/common_setup.yml (100%) diff --git a/.github/actions/common_setup.yml b/.github/actions/common_setup/common_setup.yml similarity index 100% rename from .github/actions/common_setup.yml rename to .github/actions/common_setup/common_setup.yml diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index f2955dd..90d44bb 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Common Setup - uses: ./.github/actions/common_setup.yml + uses: ./.github/actions/common_setup/action.yml with: DOCKER_USER: ${{ secrets.DOCKER_USER }} DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} From 2d18b6c99ee9b5a64ba9f32efa3c61e1794a19e0 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Fri, 22 Mar 2024 15:33:35 -0700 Subject: [PATCH 3/7] another attempt --- .github/workflows/releaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 90d44bb..d856759 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Common Setup - uses: ./.github/actions/common_setup/action.yml + uses: ./.github/actions/common_setup with: DOCKER_USER: ${{ secrets.DOCKER_USER }} DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} From 6a17d49fbbaee1a40a48e6a0c2345475b90a8a78 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Fri, 22 Mar 2024 15:40:11 -0700 Subject: [PATCH 4/7] more attempt, local mr test first --- .github/workflows/releaser.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index d856759..54da4ff 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -20,6 +20,8 @@ on: # so a vX.Y.Z-test1 doesn't trigger build - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-pre*' + pull_request: # To test + branches: [ main ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -29,7 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Common Setup - uses: ./.github/actions/common_setup + uses: fortio/workflows/.github/actions/common_setup@common_setup with: DOCKER_USER: ${{ secrets.DOCKER_USER }} DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} From ea0475c07f2fdf35102b0c2e3f2ed39a37a26482 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Fri, 22 Mar 2024 15:42:39 -0700 Subject: [PATCH 5/7] correct the name of the file --- .github/actions/common_setup/{common_setup.yml => action.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/actions/common_setup/{common_setup.yml => action.yml} (100%) diff --git a/.github/actions/common_setup/common_setup.yml b/.github/actions/common_setup/action.yml similarity index 100% rename from .github/actions/common_setup/common_setup.yml rename to .github/actions/common_setup/action.yml From 163c41383196c941f35cb2d5db5bb386321fe0ac Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Fri, 22 Mar 2024 15:49:08 -0700 Subject: [PATCH 6/7] trying passing req secrets through inputs --- .github/actions/common_setup/action.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/actions/common_setup/action.yml b/.github/actions/common_setup/action.yml index 87cf921..5377c6d 100644 --- a/.github/actions/common_setup/action.yml +++ b/.github/actions/common_setup/action.yml @@ -1,5 +1,12 @@ name: 'Common Setup' description: 'Common setup steps for build related workflows' +inputs: # Seems we can't use secrets in action.yml + DOCKER_USER: + description: 'Docker Hub username' + required: true + DOCKER_TOKEN: + description: 'Docker Hub password' + required: true runs: using: 'composite' steps: @@ -12,5 +19,5 @@ runs: - name: Log in to Docker Hub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_TOKEN }} + username: ${{ inputs.DOCKER_USER }} + password: ${{ inputs.DOCKER_TOKEN }} From eba68c4b20b1a8da91f085b0571adf72e7921a7c Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Fri, 22 Mar 2024 15:54:01 -0700 Subject: [PATCH 7/7] prepare to merge --- .github/workflows/releaser.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 54da4ff..e24586d 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -20,8 +20,8 @@ on: # so a vX.Y.Z-test1 doesn't trigger build - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-pre*' - pull_request: # To test - branches: [ main ] +# pull_request: # To test +# branches: [ main ] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -31,7 +31,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Common Setup - uses: fortio/workflows/.github/actions/common_setup@common_setup + uses: fortio/workflows/.github/actions/common_setup@main with: DOCKER_USER: ${{ secrets.DOCKER_USER }} DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}