From 2ceb87e71cc0465df41a54f9e04e44c37ca68828 Mon Sep 17 00:00:00 2001 From: David Sanders Date: Tue, 12 Nov 2024 20:08:19 -0800 Subject: [PATCH] ci: switch to GHA --- .circleci/config.yml | 50 ---------------------------------- .github/workflows/release.yml | 35 ++++++++++++++++++++++++ .github/workflows/test.yml | 51 +++++++++++++++++++++++++++++++++++ README.md | 2 +- package.json | 3 +++ 5 files changed, 90 insertions(+), 51 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 777cf5c2..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,50 +0,0 @@ -version: 2.1 - -orbs: - cfa: continuousauth/npm@2.1.1 - node: electronjs/node@2.3.1 - -workflows: - test_and_release: - # Run the test jobs first, then the release only when all the test jobs are successful - jobs: - - node/test: - name: test-<< matrix.executor >>-<< matrix.node-version >> - override-ci-command: | - if [ << matrix.node-version >> = '14.16' ]; then - yarn install --frozen-lockfile --ignore-engines - else - yarn install --frozen-lockfile - fi - pre-steps: - - run: git config --global core.autocrlf input - - when: - condition: - and: - - equal: [ node/macos, << matrix.executor >> ] - - equal: [ '14.16', << matrix.node-version >> ] - steps: - - node/install-rosetta - post-steps: - - run: yarn build:docs - matrix: - alias: test - parameters: - executor: - - node/linux - - node/macos - - node/windows - node-version: - - '20.10' - - '18.18' - - '16.20' - # Stay below 14.17.0 or nvm tries to download arm64 artifacts which don't exist - - '14.16' - - cfa/release: - requires: - - test - filters: - branches: - only: - - main - context: cfa-release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..41519405 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + push: + branches: + - main + +jobs: + test: + uses: ./.github/workflows/test.yml + + release: + name: Release + runs-on: ubuntu-latest + needs: test + environment: npm + permissions: + id-token: write # for CFA and npm provenance + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: Setup Node.js + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: 20.x + cache: 'yarn' + - name: Install + run: yarn install --frozen-lockfile + - uses: continuousauth/action@c32f05c950d4e6f4abd8d1d8a46269525e2dbf55 # v1.0.3 + with: + project-id: ${{ secrets.CFA_PROJECT_ID }} + secret: ${{ secrets.CFA_SECRET }} + npm-token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..52b078b2 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,51 @@ +name: Test + +on: + pull_request: + branches: + - main + schedule: + - cron: '0 22 * * 3' + workflow_call: + +permissions: + contents: read + +jobs: + test: + name: Test + strategy: + matrix: + node-version: + - '20.10' + - '18.18' + - '16.20' + - '14.16' + os: + - macos-latest + - ubuntu-latest + - windows-latest + runs-on: "${{ matrix.os }}" + steps: + - run: git config --global core.autocrlf input + - name: Install Rosetta + if: ${{ matrix.os == 'macos-latest' && matrix.node-version == '14.16' }} + run: /usr/sbin/softwareupdate --install-rosetta --agree-to-license + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Setup Node.js + uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 + with: + node-version: "${{ matrix.node-version }}" + cache: 'yarn' + architecture: ${{ matrix.os == 'macos-latest' && matrix.node-version == '14.16' && 'x64' || env.RUNNER_ARCH }} + - name: Install (Node.js v16+) + if : ${{ matrix.node-version != '14.16' }} + run: yarn install --frozen-lockfile + - name: Install (Node.js < v16) + if : ${{ matrix.node-version == '14.16' }} + run: yarn install --frozen-lockfile --ignore-engines + - name: Test + run: yarn test + - name: Build docs + run: yarn build:docs diff --git a/README.md b/README.md index c8ed8a11..2a08bf34 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > Download Electron release artifacts -[![CircleCI](https://circleci.com/gh/electron/get.svg?style=shield)](https://circleci.com/gh/electron/get) +[![Test](https://github.com/electron/get/actions/workflows/test.yml/badge.svg)](https://github.com/electron/get/actions/workflows/test.yml) [![NPM package](https://img.shields.io/npm/v/@electron/get)](https://npm.im/@electron/get) ## Usage diff --git a/package.json b/package.json index 3fd822ef..94b01519 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ "repository": "https://github.com/electron/get", "author": "Samuel Attard", "license": "MIT", + "publishConfig": { + "provenance": true + }, "scripts": { "build": "tsc && tsc -p tsconfig.esm.json", "build:docs": "npx typedoc",