Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ofhouse committed Feb 13, 2022
0 parents commit 4fc828e
Show file tree
Hide file tree
Showing 5 changed files with 148 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/deploy-features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Deploy Features'
on:
push:
tags:
- 'v*'

jobs:
deploy: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get tag name
id: get_tag_name
run: echo "::set-output name=tag::$(echo "${{ github.ref }}" | grep -oP 'refs/tags/\K(.+)')"

- name: Publish dev container features
uses: microsoft/publish-dev-container-features-action@main
with:
path-to-features: '.'

- name: Get or Create Release at current tag
uses: ncipollo/release-action@v1
with:
allowUpdates: true # Lets us upload our own artifact from previous step
artifactErrorsFailBuild: true
artifacts: './devcontainer-features.tgz'
token: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2022 Felix Haus (milliVolt infrastructure)
Copyright (c) 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
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Development container homebrew utils

# Features In This Repo

### homebrew-install

Install homebrew packages.

```jsonc
"features": {
"milliHQ/dev-container-features-homebrew-utils/homebrew-install": {
"tap": "aws/tap",
"packages": "aws-sam-cli"
},
}
```
22 changes: 22 additions & 0 deletions devcontainer-features.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"features": [
{
"id": "homebrew-install",
"name": "Install homebrew packages",
"documentationURL": "https://github.com/milliHQ/dev-container-features-homebrew-install/README.md",
"options": {
"tap": {
"type": "string",
"default": "",
"description": "Repositories to tap before installing the packages, separate multiple with spaces."
},
"packages": {
"type": "string",
"default": "",
"description": "Packages to install, separate multiple with spaces."
}
},
"include": ["typescript-node", "javascript-node", "ubuntu", "debian"]
}
]
}
60 changes: 60 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash
set -e

# The install.sh script is the installation entrypoint for any dev container 'features' in this repository.

# Verify we're on a supported OS
. /etc/os-release
if [ "${ID}" != "debian" ] && [ "${ID_LIKE}" != "debian" ]; then
cat << EOF
*********** Unsupported operating system "${ID}" detected ***********
Features support currently requires a Debian/Ubuntu-based image. Update your
image or Dockerfile FROM statement to start with a supported OS. For example:
mcr.microsoft.com/vscode/devcontainers/base:ubuntu
Aborting build...
EOF
exit 2
fi

# The tooling will parse the devcontainer-features.json + user devcontainer, and write
# any build-time arguments into a feature-set scoped "devcontainer-features.env"
# The author is free to source that file and use it however they would like.
set -a
. ./devcontainer-features.env
set +a


if [ ! -z ${_BUILD_ARG_HOMEBREW_INSTALL} ]; then
echo "Activating feature 'homebrew-install'"

# Check if brew command is available
if [ ! command -v brew &> /dev/null ]; then
cat << EOF
*********** homebrew not installed ***********
The command `brew` could not be found on the system.
Please make sure to add the homebrew feature before this feature.
Aborting build...
EOF
exit 2
fi

# Taps
BREW_TAPS=${_BUILD_ARG_HOMEBREW_INSTALL_TAP}

if [ "$BREW_TAPS" != "" ]; then
echo "Tapping the following repositories: ${BREW_TAPS}"
BREW_TAPS_ARRAY=( $BREW_TAPS )

for i in ${!BREW_TAPS_ARRAY[@]}
do
brew tap "${BREW_TAPS_ARRAY[i]}"
done
fi

# Install
BREW_PACKAGES=${_BUILD_ARG_HOMEBREW_INSTALL_PACKAGES}
if [ "$BREW_PACKAGES" != "" ]; then
echo "Installing brew packages: ${BREW_PACKAGES}"
brew install "${BREW_PACKAGES}"
fi
fi

0 comments on commit 4fc828e

Please sign in to comment.