Skip to content

Commit

Permalink
more stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr authored Aug 17, 2023
1 parent 8e91319 commit d3e087e
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 62 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/publish-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This just creates a bunch of tarballs and doesn't need the complicated splitting
# like feature testing does.
- run: devcontainer features publish -r ghcr.io -n ${{ github.repository }} src
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 8 additions & 2 deletions .github/workflows/test-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
fetch-depth: 0
- id: list-features
uses: devcontainers-community/list-features@v1
uses: devcontainers-community/list-features@v2
test-feature:
needs: list-features
strategy:
Expand All @@ -36,4 +36,10 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: npm install -g @devcontainers/cli
- run: devcontainer features test -f ${{ matrix.id }}
- name: devcontainer features test -f ${{ matrix.id }}
run: |
if [[ -e test/${{ matrix.id }}/test.sh ]]; then
devcontainer features test -f ${{ matrix.id }}
else
devcontainer features test -f ${{ matrix.id }} --skip-autogenerated
fi
24 changes: 6 additions & 18 deletions .github/workflows/update-feature-readmes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,17 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
list-features:
outputs:
changed-features: ${{ steps.list-features-outputs.changed-features }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: list-features
uses: devcontainers-community/list-features@v1
update-feature-readme:
needs: list-features
update-feature-readmes:
concurrency: ${{ github.ref }}-write
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.list-features.outputs.changed-features) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: devcontainers-community/update-feature-readme@v1
- uses: devcontainers/action@v1
with:
path: src/${{ matrix.id }}
base-path-to-features: src
generate-docs: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: stefanzweifel/git-auto-commit-action@v4
18 changes: 11 additions & 7 deletions .github/workflows/update-main-readme.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
name: Update main readme
name: Update readme
on:
push:
branches: "main"
paths:
- .github/workflows/update-main-readme.yml
- .github/workflows/update-readme.yml
pull_request:
paths:
- .github/workflows/update-main-readme.yml
registry_package: {}
workflow_dispatch: {}
- .github/workflows/update-readme.yml
schedule:
# https://crontab.guru/daily
- cron: "0 0 * * *"
registry_package:
workflow_dispatch:
workflow_call:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-main-readme:
update-readme:
concurrency: ${{ github.ref }}-write
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: devcontainers-community/update-features-readme@v1
- uses: devcontainers-community/update-collection-readme@v1
- uses: stefanzweifel/git-auto-commit-action@v4
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Microsoft Corporation
Copyright (c) 2023 YOUR_NAME

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
62 changes: 30 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dev Container Features: Self Authoring Template

> This repo provides a starting point and example for creating your own custom [dev container Features](https://containers.dev/implementors/features/), hosted for free on GitHub Container Registry. The example in this repository follows the [dev container Feature distribution specification](https://containers.dev/implementors/features-distribution/).
> This repo provides a starting point and example for creating your own custom [dev container Features](https://containers.dev/implementors/features/), hosted for free on GitHub Container Registry. The example in this repository follows the [dev container Feature distribution specification](https://containers.dev/implementors/features-distribution/).
>
> To provide feedback to the specification, please leave a comment [on spec issue #70](https://github.com/devcontainers/spec/issues/70). For more broad feedback regarding dev container Features, please see [spec issue #61](https://github.com/devcontainers/spec/issues/61).
Expand Down Expand Up @@ -52,7 +52,7 @@ my favorite color is green

## Repo and Feature Structure

Similar to the [`devcontainers/features`](https://github.com/devcontainers/features) repo, this repository has a `src` folder. Each Feature has its own sub-folder, containing at least a `devcontainer-feature.json` and an entrypoint script `install.sh`.
Similar to the [`devcontainers/features`](https://github.com/devcontainers/features) repo, this repository has a `src` folder. Each Feature has its own sub-folder, containing at least a `devcontainer-feature.json` and an entrypoint script `install.sh`.

```
├── src
Expand Down Expand Up @@ -113,13 +113,13 @@ Features are individually versioned by the `version` attribute in a Feature's `d

### Publishing

> NOTE: The Distribution spec can be [found here](https://containers.dev/implementors/features-distribution/).
> NOTE: The Distribution spec can be [found here](https://containers.dev/implementors/features-distribution/).
>
> While any registry [implementing the OCI Distribution spec](https://github.com/opencontainers/distribution-spec) can be used, this template will leverage GHCR (GitHub Container Registry) as the backing registry.
Features are meant to be easily sharable units of dev container configuration and installation code.
Features are meant to be easily sharable units of dev container configuration and installation code.

This repo contains a **GitHub Action** [workflow](.github/workflows/release.yaml) that will publish each Feature to GHCR.
This repo contains a **GitHub Action** [workflow](.github/workflows/release.yaml) that will publish each Feature to GHCR.

*Allow GitHub Actions to create and approve pull requests* should be enabled in the repository's `Settings > Actions > General > Workflow permissions` for auto generation of `src/<feature>/README.md` per Feature (which merges any existing `src/<feature>/NOTES.md`).

Expand All @@ -144,35 +144,33 @@ If you'd like your Features to appear in our [public index](https://containers.d

This index is from where [supporting tools](https://containers.dev/supporting) like [VS Code Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and [GitHub Codespaces](https://github.com/features/codespaces) surface Features for their dev container creation UI.

#### Using private Features in Codespaces
## License

For any Features hosted in GHCR that are kept private, the `GITHUB_TOKEN` access token in your environment will need to have `package:read` and `contents:read` for the associated repository.
Even though the `LICENSE` file in this repository says "YOUR_NAME", that's just
to be a good template. It's actually licensed under these terms:

Many implementing tools use a broadly scoped access token and will work automatically. GitHub Codespaces uses repo-scoped tokens, and therefore you'll need to add the permissions in `devcontainer.json`

An example `devcontainer.json` can be found below.

```jsonc
{
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"ghcr.io/my-org/private-features/hello:1": {
"greeting": "Hello"
}
},
"customizations": {
"codespaces": {
"repositories": {
"my-org/private-features": {
"permissions": {
"packages": "read",
"contents": "read"
}
}
}
}
}
}
```
MIT License
Copyright (c) 2022 Microsoft Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

---
Expand Down

0 comments on commit d3e087e

Please sign in to comment.