Skip to content

Commit d1b931c

Browse files
authored
Merge pull request #3301 from itowlson/environment-definitions-starter-pack
Environment definitions starter pack
2 parents 92feb35 + a08a2ed commit d1b931c

File tree

6 files changed

+76
-0
lines changed

6 files changed

+76
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish environment definition to registry
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "spin-up.(ver).toml version, e.g. 3.4, 3.5"
8+
required: true
9+
type: string
10+
11+
jobs:
12+
publish-env-def:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write
16+
packages: write
17+
contents: write
18+
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Install oras
24+
uses: oras-project/setup-oras@v1
25+
26+
- name: Login to the GitHub registry
27+
uses: docker/login-action@v3
28+
with:
29+
registry: ghcr.io
30+
username: spinframeworkbot
31+
password: ${{ secrets.SPIN_WIT_PAT }}
32+
33+
- name: Publish environment TOML
34+
shell: bash
35+
env:
36+
VERSION: ${{ inputs.version }}
37+
run: ./scripts/push-env-def.sh

scripts/push-env-def.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
oras push ghcr.io/spinframework/environments/spin-up:$VERSION target-envs/spin-up.$VERSION.toml

target-envs/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Spin target environments
2+
3+
This folder contains target environment definitions for Spin. Each target
4+
environment is a TOML file which maps triggers to the WIT worlds supported by
5+
those triggers. When pushed to an OCI registry, these can be referenced
6+
in the Spin manifest `application.targets` array.
7+
8+
Pushed environment definitions should not include the `.toml` extension
9+
and should be versioned using OCI versioning, e.g. `spin-up:3.4`
10+
We avoid using this convention for the source files because 1. syntax
11+
highlighting and 2. Windows filenames.
12+
13+
Versions should include _minor version only_ because WITs should not
14+
change in patch releases.

target-envs/spin-up.3.2.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
default = { worlds = ["spin:up/[email protected]"] }
2+
3+
[triggers]
4+
5+
[triggers.http]
6+
worlds = ["spin:up/[email protected]"]
7+
capabilities = ["local_service_chaining"]

target-envs/spin-up.3.4.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
default = { worlds = ["spin:up/[email protected]"] }
2+
3+
[triggers]
4+
5+
[triggers.http]
6+
worlds = ["spin:up/[email protected]"]
7+
capabilities = ["local_service_chaining"]

target-envs/spin-up.3.5.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
default = { worlds = ["spin:up/[email protected]"] }
2+
3+
[triggers]
4+
5+
[triggers.http]
6+
worlds = ["spin:up/[email protected]", "spin:up/[email protected]"]
7+
capabilities = ["local_service_chaining"]

0 commit comments

Comments
 (0)