From edb31b7948a15cce29921be205109b74324bdd00 Mon Sep 17 00:00:00 2001 From: Antti Harju Date: Fri, 9 Aug 2024 12:55:51 +0300 Subject: [PATCH] Migrate CI away from erb templates (#470) --- .github/templates/jobs/build.erb | 24 ------- .github/templates/jobs/test.erb | 18 ----- .github/templates/pull_request.yml.erb | 27 ------- .github/templates/release.yml.erb | 24 ------- .github/workflows/build.yml | 65 +++++++++++++++++ .github/workflows/check_release_label.yml | 17 +++-- .github/workflows/pull_request.generated.yml | 76 -------------------- .github/workflows/pull_request.yml | 11 +++ .github/workflows/release.generated.yml | 56 --------------- .github/workflows/release.yml | 11 +++ 10 files changed, 95 insertions(+), 234 deletions(-) delete mode 100644 .github/templates/jobs/build.erb delete mode 100644 .github/templates/jobs/test.erb delete mode 100644 .github/templates/pull_request.yml.erb delete mode 100644 .github/templates/release.yml.erb create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/pull_request.generated.yml create mode 100644 .github/workflows/pull_request.yml delete mode 100644 .github/workflows/release.generated.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/templates/jobs/build.erb b/.github/templates/jobs/build.erb deleted file mode 100644 index 0565755b..00000000 --- a/.github/templates/jobs/build.erb +++ /dev/null @@ -1,24 +0,0 @@ -build: - runs-on: <%= ubuntu_version %> - steps: - - uses: actions/checkout@v2 - - name: Set Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.x - - name: "Install" - run: | - npm install - - name: "Prettier" - run: | - npm run format-check - - name: "Lint" - run: | - npm run lint - - name: "Test" - run: | - npm run test - - name: "build" - run: | - npm run build - npm run package diff --git a/.github/templates/jobs/test.erb b/.github/templates/jobs/test.erb deleted file mode 100644 index 60584857..00000000 --- a/.github/templates/jobs/test.erb +++ /dev/null @@ -1,18 +0,0 @@ -test: - runs-on: <%= ubuntu_version %> - steps: - - uses: actions/checkout@v2 - - name: Set Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.x - - name: "Build action for test" - run: | - npm install - npm run all - git clean -fXd - - name: Test executing the action - uses: ./ - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - enforce: false diff --git a/.github/templates/pull_request.yml.erb b/.github/templates/pull_request.yml.erb deleted file mode 100644 index 294e87b2..00000000 --- a/.github/templates/pull_request.yml.erb +++ /dev/null @@ -1,27 +0,0 @@ -name: "Pull Request" - -on: - pull_request: - branches: [master] - -jobs: - @import ./jobs/build - - @import ./jobs/test - - release: - runs-on: <%= ubuntu_version %> - name: "Build and release action" - needs: [build, test] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - persist-credentials: true - - name: Configure git - uses: smartlyio/github-actions@git-init-userinfo-v1 - - name: Release flow - uses: smartlyio/github-actions@release-action-node-v1 - with: - dry_run: true - token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/templates/release.yml.erb b/.github/templates/release.yml.erb deleted file mode 100644 index 8761aace..00000000 --- a/.github/templates/release.yml.erb +++ /dev/null @@ -1,24 +0,0 @@ -name: Build and release the action - -on: - push: - branches: [master] - -jobs: - @import ./jobs/build - - release: - runs-on: <%= ubuntu_version %> - name: "Build and release action" - needs: [build] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - persist-credentials: true - - name: Configure git - uses: smartlyio/github-actions@git-init-userinfo-v1 - - name: Release flow - uses: smartlyio/github-actions@release-action-node-v1 - with: - token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..fec458d7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: Build + +on: workflow_call + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Set Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + - name: "Install" + run: | + npm install + - name: "Prettier" + run: | + npm run format-check + - name: "Lint" + run: | + npm run lint + - name: "Test" + run: | + npm run test + - name: "build" + run: | + npm run build + npm run package + + test: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Set Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + - name: "Build action for test" + run: | + npm install + npm run all + git clean -fXd + - name: Test executing the action + uses: ./ + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + enforce: false + + release: + runs-on: ubuntu-22.04 + name: "Build and release action" + needs: [build, test] + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + persist-credentials: true + - name: Configure git + uses: smartlyio/github-actions@git-init-userinfo-v1 + - name: Release flow + uses: smartlyio/github-actions@release-action-node-v1 + with: + dry_run: ${{ github.event_name == 'pull_request' }} + token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/check_release_label.yml b/.github/workflows/check_release_label.yml index 1ea0d5cd..df95d010 100644 --- a/.github/workflows/check_release_label.yml +++ b/.github/workflows/check_release_label.yml @@ -3,18 +3,17 @@ name: Check Labels on: pull_request: branches: - - master + - master types: - - opened - - labeled - - unlabeled - - synchronize + - opened + - labeled + - unlabeled + - synchronize jobs: check_labels: runs-on: ubuntu-22.04 steps: - - uses: smartlyio/check-versioning-action@v5 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + - uses: smartlyio/check-versioning-action@v5 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pull_request.generated.yml b/.github/workflows/pull_request.generated.yml deleted file mode 100644 index 51a46ed3..00000000 --- a/.github/workflows/pull_request.generated.yml +++ /dev/null @@ -1,76 +0,0 @@ -# IMPORTANT NOTE/WARNING! -# Do not make changes to this file, your changes will be overwritten. -# -# This file is automagically generated from: -# - .github/templates/pull_request.yml.erb -# - Templates contained in the smartlyio/github-actions-templates repository -# -# This file can be updated by editing the template file, and running `devbox render workflows` - -name: "Pull Request" - -on: - pull_request: - branches: [master] - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Set Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.x - - name: "Install" - run: | - npm install - - name: "Prettier" - run: | - npm run format-check - - name: "Lint" - run: | - npm run lint - - name: "Test" - run: | - npm run test - - name: "build" - run: | - npm run build - npm run package - - test: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Set Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.x - - name: "Build action for test" - run: | - npm install - npm run all - git clean -fXd - - name: Test executing the action - uses: ./ - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - enforce: false - - release: - runs-on: ubuntu-20.04 - name: "Build and release action" - needs: [build, test] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - persist-credentials: true - - name: Configure git - uses: smartlyio/github-actions@git-init-userinfo-v1 - - name: Release flow - uses: smartlyio/github-actions@release-action-node-v1 - with: - dry_run: true - token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 00000000..929dda6c --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,11 @@ +name: Pull Request + +on: + pull_request: + branches: [master] + +jobs: + build: + name: Build + uses: ./.github/workflows/build.yml + secrets: inherit diff --git a/.github/workflows/release.generated.yml b/.github/workflows/release.generated.yml deleted file mode 100644 index ff0e6d88..00000000 --- a/.github/workflows/release.generated.yml +++ /dev/null @@ -1,56 +0,0 @@ -# IMPORTANT NOTE/WARNING! -# Do not make changes to this file, your changes will be overwritten. -# -# This file is automagically generated from: -# - .github/templates/release.yml.erb -# - Templates contained in the smartlyio/github-actions-templates repository -# -# This file can be updated by editing the template file, and running `devbox render workflows` - -name: Build and release the action - -on: - push: - branches: [master] - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Set Node.js 20.x - uses: actions/setup-node@v3 - with: - node-version: 20.x - - name: "Install" - run: | - npm install - - name: "Prettier" - run: | - npm run format-check - - name: "Lint" - run: | - npm run lint - - name: "Test" - run: | - npm run test - - name: "build" - run: | - npm run build - npm run package - - release: - runs-on: ubuntu-20.04 - name: "Build and release action" - needs: [build] - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - persist-credentials: true - - name: Configure git - uses: smartlyio/github-actions@git-init-userinfo-v1 - - name: Release flow - uses: smartlyio/github-actions@release-action-node-v1 - with: - token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..8c67f0b6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,11 @@ +name: Release + +on: + push: + branches: [master] + +jobs: + build: + name: Build + uses: ./.github/workflows/build.yml + secrets: inherit