-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (44 loc) · 1.42 KB
/
cd-features.yml
File metadata and controls
50 lines (44 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: "CD: Publish DevContainer Feature"
on:
push:
tags:
- "features/**"
workflow_dispatch:
inputs:
tag:
description: "Tag name (e.g., features/devcontainer-cli/v1.0.0)"
required: true
type: string
jobs:
publish:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v6
- name: Extract feature name from tag
id: meta
run: |
# features/devcontainer-cli/v1.0.0 → devcontainer-cli
TAG="${{ inputs.tag || github.ref_name }}"
NAME=$(echo "$TAG" | cut -d'/' -f2)
echo "name=$NAME" >> "$GITHUB_OUTPUT"
- name: Validate feature exists
run: |
if [ ! -d "features/src/${{ steps.meta.outputs.name }}" ]; then
echo "::error::Feature '${{ steps.meta.outputs.name }}' not found"
exit 1
fi
- name: Prepare single feature for publish
run: |
mkdir -p /tmp/publish-features
cp -r "features/src/${{ steps.meta.outputs.name }}" /tmp/publish-features/
- name: Publish feature
uses: devcontainers/action@v1
with:
publish-features: true
base-path-to-features: /tmp/publish-features
features-namespace: ${{ github.repository_owner }}/${{ github.event.repository.name }}-features
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}