From b58adc1462092f81776922483cc2c6bcf05db5d7 Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 13:57:17 +0200 Subject: [PATCH 01/11] feat: deploy-please --- .github/workflows/deploy-please.yml | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/deploy-please.yml diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml new file mode 100644 index 0000000..a029863 --- /dev/null +++ b/.github/workflows/deploy-please.yml @@ -0,0 +1,44 @@ +name: Deploy Please + +on: + workflow_call: + inputs: + apps: + type: string + description: A comma-separated list of Scalingo apps to deploy. For example, "hedia-com-foo,hedia-dev-foo". + required: true + version: + type: string + description: The tag version to deploy. For example, "v1.0.0". If not provided, the release that triggered the workflow will be used. + required: false + secrets: + HEDIA_BOT_GITHUB_PAT: + description: Needed to deploy to Scalingo + required: true + SCALINGO_TOKEN: + description: Needed to deploy to Scalingo + required: true + +jobs: + deploy-please: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Download the Release + run: gh release download ${{ inputs.version || github.ref_name }} --archive=tar.gz + env: + GH_TOKEN: ${{ secrets.HEDIA_BOT_GITHUB_PAT }} + + - name: Setup Scalingo CLI + run: | + curl -O https://cli-dl.scalingo.com/install && + bash install && + scalingo login --api-token ${{ secrets.SCALINGO_TOKEN }} + + - name: Deploy to Scalingo + run: | + for app in ${${{ inputs.apps }}//,/ } + do + scalingo --app $app deploy ${{ github.repository.name }}-${{ inputs.version || github.ref_name }}.tar.gz + done From fa7a822dc14fb6cd7e2e39718f37b38e2e01c2be Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 15:44:49 +0200 Subject: [PATCH 02/11] ci: rename --- .github/workflows/deploy-please.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index a029863..18d6048 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -9,7 +9,7 @@ on: required: true version: type: string - description: The tag version to deploy. For example, "v1.0.0". If not provided, the release that triggered the workflow will be used. + description: The release version to deploy. For example, "v1.0.0". If not provided, the release that triggered the workflow will be used. required: false secrets: HEDIA_BOT_GITHUB_PAT: From 1225dd49497cb1f926e00a8ddac30af74a472038 Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 15:50:42 +0200 Subject: [PATCH 03/11] ci: checkout repo --- .github/workflows/deploy-please.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index 18d6048..30b87f3 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -25,6 +25,9 @@ jobs: timeout-minutes: 10 steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Download the Release run: gh release download ${{ inputs.version || github.ref_name }} --archive=tar.gz env: From 4688964f0e435e13425d9155a64649dc31abf5f2 Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 15:57:38 +0200 Subject: [PATCH 04/11] ci: fix repository name --- .github/workflows/deploy-please.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index 30b87f3..17d2b37 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -43,5 +43,5 @@ jobs: run: | for app in ${${{ inputs.apps }}//,/ } do - scalingo --app $app deploy ${{ github.repository.name }}-${{ inputs.version || github.ref_name }}.tar.gz + scalingo --app $app deploy ${{ github.event.repository.name }}-${{ inputs.version || github.ref_name }}.tar.gz done From f9ca44bf9c97a99552e9feb1a1fb9fbb6608a802 Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 15:58:46 +0200 Subject: [PATCH 05/11] ci: ls --- .github/workflows/deploy-please.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index 17d2b37..0f20537 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -41,6 +41,7 @@ jobs: - name: Deploy to Scalingo run: | + ls for app in ${${{ inputs.apps }}//,/ } do scalingo --app $app deploy ${{ github.event.repository.name }}-${{ inputs.version || github.ref_name }}.tar.gz From 5f20847cf07945e2caf8ac5bbd6ee791e5e88d27 Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 16:05:55 +0200 Subject: [PATCH 06/11] ci: fix file name --- .github/workflows/deploy-please.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index 0f20537..34cde62 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -41,8 +41,11 @@ jobs: - name: Deploy to Scalingo run: | - ls - for app in ${${{ inputs.apps }}//,/ } + for app in ${APPS//,/} do - scalingo --app $app deploy ${{ github.event.repository.name }}-${{ inputs.version || github.ref_name }}.tar.gz + scalingo --app $app deploy "${REPO}-${VERSION:1}.tar.gz" done + env: + APPS: ${{ inputs.apps }} + REPO: ${{ github.event.repository.name }} + VERSION: ${{ inputs.version || github.ref_name }} From 535e0d52c65cd9097efd67b239e47e352387453c Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 16:11:50 +0200 Subject: [PATCH 07/11] perf: faster action --- .github/workflows/deploy-please.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index 34cde62..a069bcc 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -43,7 +43,7 @@ jobs: run: | for app in ${APPS//,/} do - scalingo --app $app deploy "${REPO}-${VERSION:1}.tar.gz" + scalingo --app $app deploy --no-follow "${REPO}-${VERSION:1}.tar.gz" $VERSION done env: APPS: ${{ inputs.apps }} From 4fc22bbfd6863c07fc61e39147aeacf639fb3946 Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 16:33:37 +0200 Subject: [PATCH 08/11] ci: update timeouts --- .github/workflows/deploy-please.yml | 4 ++-- .github/workflows/dockerize-please.yml | 2 ++ .github/workflows/issue.yml | 1 + .github/workflows/publish-please.yml | 4 ++-- .github/workflows/pull-request.yml | 2 ++ .github/workflows/release-please.yml | 2 ++ .github/workflows/update-please.yml | 1 + 7 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index a069bcc..74dade3 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -11,6 +11,7 @@ on: type: string description: The release version to deploy. For example, "v1.0.0". If not provided, the release that triggered the workflow will be used. required: false + secrets: HEDIA_BOT_GITHUB_PAT: description: Needed to deploy to Scalingo @@ -22,8 +23,7 @@ on: jobs: deploy-please: runs-on: ubuntu-latest - timeout-minutes: 10 - + timeout-minutes: 5 steps: - name: Checkout Repository uses: actions/checkout@v4 diff --git a/.github/workflows/dockerize-please.yml b/.github/workflows/dockerize-please.yml index e9318f9..f6bbde2 100644 --- a/.github/workflows/dockerize-please.yml +++ b/.github/workflows/dockerize-please.yml @@ -12,6 +12,7 @@ on: description: The tag to use for the Docker image required: false default: latest + secrets: READONLY_NPM_TOKEN: description: Needed to install private @hedia npm packages @@ -28,6 +29,7 @@ permissions: jobs: dockerize-please: runs-on: ubuntu-latest + timeout-minutes: 10 steps: - name: Check out code uses: actions/checkout@v4 diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml index cbcca9a..ad5e161 100644 --- a/.github/workflows/issue.yml +++ b/.github/workflows/issue.yml @@ -16,6 +16,7 @@ on: jobs: issue: runs-on: ubuntu-latest + timeout-minutes: 1 steps: - name: Link Project uses: actions/add-to-project@releases/v1 diff --git a/.github/workflows/publish-please.yml b/.github/workflows/publish-please.yml index 5630b8b..eba5d63 100644 --- a/.github/workflows/publish-please.yml +++ b/.github/workflows/publish-please.yml @@ -7,6 +7,7 @@ on: description: The git ref to publish type: string required: true + secrets: READONLY_NPM_TOKEN: description: Needed to install private @hedia npm packages @@ -18,8 +19,7 @@ on: jobs: publish-please: runs-on: ubuntu-latest - timeout-minutes: 10 - + timeout-minutes: 5 steps: - name: Checkout Repository uses: actions/checkout@v4 diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index e6d1ff1..fc7c2c9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -18,6 +18,7 @@ on: type: string description: A comma-separated list of GitHub teams to request a review from. required: false + secrets: HEDIA_BOT_GITHUB_PAT: description: Needed to link project @@ -26,6 +27,7 @@ on: jobs: pull-request: runs-on: ubuntu-latest + timeout-minutes: 1 steps: - id: link-project name: Link Project diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 5e3bb54..e97948a 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -9,6 +9,7 @@ on: tag_name: description: "The tag name (version number) of the release created" value: ${{ jobs.release-please.outputs.tag_name }} + secrets: HEDIA_BOT_GITHUB_PAT: description: Needed to run release-please @@ -21,6 +22,7 @@ permissions: jobs: release-please: runs-on: ubuntu-latest + timeout-minutes: 5 if: > github.event_name == 'workflow_dispatch' || ( diff --git a/.github/workflows/update-please.yml b/.github/workflows/update-please.yml index ff72265..8a04675 100644 --- a/.github/workflows/update-please.yml +++ b/.github/workflows/update-please.yml @@ -23,6 +23,7 @@ permissions: jobs: update-please: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - name: Checkout Repository uses: actions/checkout@v4 From 1dd1b6abf8a3e85cfe215ad2ecbb67a6cbc12fa1 Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Tue, 11 Jun 2024 16:40:56 +0200 Subject: [PATCH 09/11] ci: removed default parameters --- .github/workflows/dockerize-please.yml | 1 - .github/workflows/publish-please.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/dockerize-please.yml b/.github/workflows/dockerize-please.yml index f6bbde2..10d5bef 100644 --- a/.github/workflows/dockerize-please.yml +++ b/.github/workflows/dockerize-please.yml @@ -35,7 +35,6 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ inputs.github_ref || inputs.tag_name }} - fetch-depth: 1 - name: Create .npmrc run: echo "//registry.npmjs.org/:_authToken=${{ secrets.READONLY_NPM_TOKEN }}" > .npmrc diff --git a/.github/workflows/publish-please.yml b/.github/workflows/publish-please.yml index eba5d63..55dff56 100644 --- a/.github/workflows/publish-please.yml +++ b/.github/workflows/publish-please.yml @@ -25,7 +25,6 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ inputs.github_ref }} - fetch-depth: 1 - name: Setup Node.js Environment uses: actions/setup-node@v4 From 832ce5a5c25cd350c8d61a2d6ca781bfb74f19fb Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Wed, 12 Jun 2024 10:28:56 +0200 Subject: [PATCH 10/11] ci: skip major releases --- .github/workflows/deploy-please.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index 74dade3..2f27082 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -22,6 +22,7 @@ on: jobs: deploy-please: + if: inputs.version || endsWith(github.ref_name, '.0.0') == false runs-on: ubuntu-latest timeout-minutes: 5 steps: From 9c5c4273c3ba7824b50d187b12874c7ce70dcf5f Mon Sep 17 00:00:00 2001 From: Mathieu Veber Date: Wed, 12 Jun 2024 13:28:51 +0200 Subject: [PATCH 11/11] ci: fix error --- .github/workflows/deploy-please.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy-please.yml b/.github/workflows/deploy-please.yml index 2f27082..b50da81 100644 --- a/.github/workflows/deploy-please.yml +++ b/.github/workflows/deploy-please.yml @@ -42,7 +42,7 @@ jobs: - name: Deploy to Scalingo run: | - for app in ${APPS//,/} + for app in ${APPS//,/ } do scalingo --app $app deploy --no-follow "${REPO}-${VERSION:1}.tar.gz" $VERSION done