diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 7ab95d51..c0cc15bf 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -6,7 +6,7 @@ on: - main - docs paths: - - ".github/workflows/deploy-docs.yaml" + - ".github/workflows/deploy-docs.yml" - "docs/**" - "internal/cli/**" diff --git a/.github/workflows/publish-examples.yml b/.github/workflows/publish-examples.yml new file mode 100644 index 00000000..c9ac8f5d --- /dev/null +++ b/.github/workflows/publish-examples.yml @@ -0,0 +1,52 @@ +name: Publish recipe examples + +on: + push: + branches: + - main + paths: + - ".github/workflows/publish-examples.yml" + - "examples/**" + +jobs: + publish: + name: Publish example recipes + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + steps: + - uses: actions/checkout@v3 + + - uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-go@v3 + with: + go-version: "1.21" + + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-golang-${{ hashFiles('go.sum') }} + restore-keys: | + ${{ runner.os }}-golang- + + - uses: arduino/setup-task@v1 + with: + version: 3.x + repo-token: ${{ secrets.GITHUB_TOKEN }} # https://github.com/arduino/setup-task#repo-token + + - name: Push example recipes to GitHub Packages + run: | + for dir in examples/*/ # list directories in the form "examples/dirname/" + do + dir=${dir%*/} # remove the trailing "/" + task run -- validate ${dir} + task run -- push ${dir} oci://ghcr.io/futurice/jalapeno/${dir} + done diff --git a/docs/site/docs/usage.md b/docs/site/docs/usage.md index 2f31b949..8072c18f 100644 --- a/docs/site/docs/usage.md +++ b/docs/site/docs/usage.md @@ -37,6 +37,12 @@ mkdir my-project jalapeno execute my-recipe -d my-project ``` +You can also execute any of the examples from the Jalapeno repository, for example: + +```bash +jalapeno execute oci://ghcr.io/futurice/jalapeno/examples/variable-types:0.0.0 -d my-project +``` + After this, the project directory should have the following files: ```