Skip to content

Commit

Permalink
Update the GitHub actions workflow specifications (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
IMax153 authored Sep 2, 2024
1 parent 00ce7a0 commit 6221056
Show file tree
Hide file tree
Showing 13 changed files with 1,507 additions and 2,229 deletions.
1 change: 1 addition & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/consistent-type-imports": "warn",
"@typescript-eslint/no-unused-vars": ["error", {
"argsIgnorePattern": "^_",
Expand Down
21 changes: 21 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Setup
description: Perform standard setup and install dependencies using pnpm.
inputs:
node-version:
description: The version of Node.js to install
required: true
default: 20.16.0

runs:
using: composite
steps:
- name: Install pnpm
uses: pnpm/action-setup@v3
- name: Install node
uses: actions/setup-node@v4
with:
cache: pnpm
node-version: ${{ inputs.node-version }}
- name: Install dependencies
shell: bash
run: pnpm install
54 changes: 54 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Check

on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup

types:
name: Types
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm check

lint:
name: Lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm lint

test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm test
41 changes: 18 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
name: Main Flow
name: Release

on:
push:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

permissions: {}

jobs:
build:
release:
if: github.repository_owner = 'Effect-Ts'
name: Release
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.9.0]

timeout-minutes: 10
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
name: Install pnpm
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: pnpm
node-version: ${{ matrix.node-version }}
- run: pnpm install
- run: pnpm build
- run: pnpm test
- run: pnpm lint
- run: pnpm docgen
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
version: pnpm update-version
publish: pnpm changeset publish
version: pnpm changeset-version
publish: pnpm changeset-publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Pages

on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/setup
- run: pnpm docgen
- name: Build pages Jekyll
if: github.repository_owner == 'Effect-Ts' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- name: Upload pages artifact
if: github.repository_owner == 'Effect-Ts' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v2

deploy:
if: github.repository_owner == 'Effect-Ts' && github.event_name == 'push' && github.ref == 'refs/heads/main'
name: Deploy
runs-on: ubuntu-latest
timeout-minutes: 10
needs: build
permissions:
pages: write # To deploy to GitHub Pages
id-token: write # To verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
31 changes: 0 additions & 31 deletions .github/workflows/pr.yml

This file was deleted.

40 changes: 3 additions & 37 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 16 additions & 30 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,36 +1,22 @@
{
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs/nixpkgs-unstable";
};

flake-utils = {
url = "github:numtide/flake-utils";
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};

outputs = {
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
corepackEnable = pkgs.runCommand "corepack-enable" {} ''
mkdir -p $out/bin
${pkgs.nodejs_20}/bin/corepack enable --install-directory $out/bin
'';
in {
formatter = pkgs.alejandra;

devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_20
corepackEnable
];
};
outputs = {nixpkgs, ...}: let
forAllSystems = function:
nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed
(system: function nixpkgs.legacyPackages.${system});
in {
formatter = forAllSystems (pkgs: pkgs.alejandra);
devShells = forAllSystems (pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
bun
corepack
deno
nodejs
];
};
});
};
}
Loading

0 comments on commit 6221056

Please sign in to comment.