Skip to content

Loag/akshon

Repository files navigation

akshon

the intent of this project is to have an experience similar to the AWSCDK or CDK8S for writing any ci/cd pipeline.

Example

this example builds the respective supported language libs and uploads them as an artifact

import { Workflow, Job, Step, Action, actions } from './src/index';

const workflowProps = {
  name: 'build akshon artifact',
  on: {
    push: {
      branches: ['master'],
    },
  },
};

const workflow = new Workflow(workflowProps);

const buildJob = new Job(workflow, 'build', {
  runsOn: 'ubuntu-latest',
  name: 'Build',
});

Step.fromAction(buildJob, 'checkout', new Action('actions', 'checkout', 'v5'));

Step.fromAction(buildJob, 'setup-node', new Action('actions', 'setup-node', 'v5'), {
  with: {
    'node-version': 24.11,
  },
});

Step.fromAction(buildJob, 'setup-java', new Action('actions', 'setup-java', 'v4'), {
  with: {
    "distribution": 'temurin',
    "java-version": 17
  },
});

Step.fromAction(buildJob, 'setup-dotnet', new Action('actions', 'setup-dotnet', 'v4'), {
  with: {
    "dotnet-version": 8.0,
  },
});

Step.fromAction(buildJob, 'setup-python', new Action('actions', 'setup-python', 'v4'), {
  with: {
    "python-version": 3.11,
  },
});

Step.fromAction(buildJob, 'setup-go', new Action('actions', 'setup-go', 'v4'), {
  with: {
    "go-version": 1.23,
  },
});

new Step(buildJob, 'install-deps', {
  name: 'Install dependencies',
  run: 'npm install',
});

new Step(buildJob, 'build', {
  name: 'Build',
  run: 'npm run build',
});

new Step(buildJob, 'package', {
  name: 'Package',
  run: 'npm run package',
});

Step.fromAction(buildJob, 'upload-artifact', new Action('actions', 'upload-artifact', 'v5'), {
  with: {
    name: 'build-artifact',
    path: 'dist',
    overwrite: true
  },
});

workflow.addJob('build', buildJob);

const filePath = workflow.synth();
console.log(`Generated workflow file: ${filePath}`);

Output

# this file was generated by a tool. DO NOT EDIT

name: build akshon artifact
on:
  push:
    branches:
      - master
jobs:
  build:
    runs-on: ubuntu-latest
    name: Build
    steps:
      - uses: actions/checkout@v5
      - uses: actions/setup-node@v5
        with:
          node-version: 24.11
      - uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: 17
      - uses: actions/setup-dotnet@v4
        with:
          dotnet-version: 8
      - uses: actions/setup-python@v4
        with:
          python-version: 3.11
      - uses: actions/setup-go@v4
        with:
          go-version: 1.23
      - name: Install dependencies
        run: npm install
      - name: Build
        run: npm run build
      - name: Package
        run: npm run package
      - uses: actions/upload-artifact@v5
        with:
          name: build-artifact
          path: dist
          overwrite: true

TODO

  • doing scripts

cli:

  • create/init new project: creates a config for the project
  • synth: gen the output.

About

github action as code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages