GitHub Actions
Quick Start
Use a GitHub Action to build and push a new Acorn into a Packages repository each time a new version is tagged:
# Save into your repo as .github/workflows/on-tag.yaml
name: On Tag
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- uses: acorn-io/actions-[email protected]
- uses: acorn-io/actions-[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set Tag
run: |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Build and Push
run: |
acorn build --tag ghcr.io/${{ github.repository }}:$TAG .
acorn push ghcr.io/${{ github.repository }}:$TAG
The action is automatically provided with a GITHUB_TOKEN
that already has permission to push to the registry for its own repo, so no special secrets configuration is needed.
You can choose any other Linux or macOS runner for the runs-on
, see GitHub Docs for available choices or specify your own self-hosted runner.
Setup Action
The setup action creates a k3s cluster, installs acorn, and hooks everything up so you can use the acorn
CLI just like you would from your workstation.
Usage
name: My Workflow
on:
push: {}
jobs:
publish:
steps:
- uses: actions/[email protected]
- uses: acorn-io/actions-[email protected]
- run: |
# Do something with the CLI
acorn --version
Options
Key | Default | Description |
---|---|---|
acorn-version | latest | Version of Acorn to install |
k3s-version | latest | Version of K3s to install |
kubeconfig | (none) | Provide a kubeconfig to use instead of installing k3s |
See actions-setup for additional advanced options. For example it is possible to point acorn at an existing k8s cluster instead of spinning up a new one.
Login Action
The login action logs into a registry so that later steps can push an acorn to it.
Usage
name: My Workflow
on:
push:
tags:
- "v*"
jobs:
publish:
steps:
- uses: actions/[email protected]
- uses: acorn-io/actions-[email protected]
- uses: acorn-io/actions-[email protected]
with:
registry: docker.io
username: yourDockerHubUsername
password: ${{ secrets.DOCKERHUB_PASSWORD }}
Options
Key | Default | Description |
---|---|---|
registry | Required | Registry address to login to (e.g. ghcr.io or docker.io ) |
username | Required | Registry username |
password | Required | Registry password |