Github actions

Commander

This Github action simplifies the creation of simple build tasks.

Usage

The following example creates and builds a buildtask.

First, create a file commander.yml at the root of the project. This file is the entrypoint for the task generation, each command will be executed during the build process.

# commander.yml
laraboot-commander:
  commands:
    - ls
    - pwd
    - git --version

The following is an example of how the build and publish processes work together in a CI environment. It considers OCI registry for publication. In this case docker hub.

# .github/workflows/actions.yml
# This is a basic workflow to help you get started with Laraboot using Github Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
  push:
    branches:
      - next

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: buildpacks/github-actions/setup-pack@v4.1.0
      - uses: actions/setup-go@v1
        with:
          go-version: 1.16.x
      - uses: actions/setup-node@v1
        with:
          node-version: 12
      - name: Setup laraboot CLI
        env:
          NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
        uses: laraboot-io/github-actions/setup-cli@cli-actions
      - name: Authenticate
        run: |
          echo "${{ secrets.LARABOOT_TOKEN }}" | laraboot login --user "${{ secrets.LARABOOT_USERNAME }}" -vvv
      - name: Build
        id: build
        uses: laraboot-io/github-actions/commander@next
        with:
          # Replace this with
          buildtask-name: mybuildtask

      - name: Login to Docker Hub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKER_HUB_USERNAME }}
          password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}

      - name: Release into DockerHub
        env:
          # or consume ${{ steps.build.outputs.buildtask_name }}
          BUILDTASK_NAME: mybuildtask
          ECR_REGISTRY: ${{ secrets.DOCKER_HUB_USERNAME }}
        run: |
          # Use current branch as tag
          docker tag $BUILDTASK_NAME $ECR_REGISTRY/$BUILDTASK_NAME:${GITHUB_REF##*/}
          docker push $ECR_REGISTRY/$BUILDTASK_NAME:${GITHUB_REF##*/}

Commander will only build the task but it doesn't publish it.-

Last updated