-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding workflow file * Adding to testing branch * Debugging removal of directory * Replacing file name variable * Adding registry name * Adding docker login * Fixing Repository Name * Giving Feature a better name * Fixing artifact name * Adding microsoft org name --------- Co-authored-by: Kevin Mack <[email protected]>
- Loading branch information
1 parent
06dc53b
commit d84a007
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: k3s-on-host | ||
|
||
on: | ||
push: | ||
branches: [ km/adding_action ] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-package-feature: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
|
||
- name: Install devcontainer cli | ||
run: | | ||
npm install -g @devcontainers/cli | ||
devcontainer --version | ||
printenv | ||
- name: Install oras | ||
run: | | ||
curl -LO https://github.com/oras-project/oras/releases/download/v0.16.0/oras_0.16.0_linux_amd64.tar.gz | ||
mkdir -p oras-install/ | ||
tar -zxf oras_0.16.0_*.tar.gz -C oras-install/ | ||
mv oras-install/oras /usr/local/bin/ | ||
rm -rf oras_0.16.0_*.tar.gz oras-install/ | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Building Feature Package | ||
run: | | ||
mkdir -p ./output | ||
echo "devcontainer features package --force-clean-output-folder ./.devcontainer/features --output-folder ./output" | ||
devcontainer features package --force-clean-output-folder ./.devcontainer/features --output-folder ./output | ||
sub_exit_code=${PIPESTATUS[0]} | ||
if [[ $sub_exit_code -gt 0 ]]; then | ||
echo "Previous step failed. Troubleshoot" | ||
exit 1 | ||
fi | ||
- name: Pushing Feature Package | ||
run: | | ||
echo "oras push ${{ env.REGISTRY }}/microsoft/devcontainers/features/k3s-on-host:latest --config /dev/null:application/vnd.devcontainers ./output/devcontainer-feature-k3s-on-host.tgz:application/vnd.devcontainers.layer.v1+tar" | ||
oras push ${{ env.REGISTRY }}/microsoft/devcontainers/features/k3s-on-host:latest \ | ||
--config /dev/null:application/vnd.devcontainers \ | ||
./output/devcontainer-feature-k3s-on-host.tgz:application/vnd.devcontainers.layer.v1+tar | ||
sub_exit_code=${PIPESTATUS[0]} | ||
if [[ $sub_exit_code -gt 0 ]]; then | ||
echo "Previous step failed. Troubleshoot" | ||
exit 1 | ||
fi | ||
echo "oras push ${{ env.REGISTRY }}/microsoft/devcontainers/features/k3s-on-host:latest --config /dev/null:application/vnd.devcontainers ./output/devcontainer-feature-k3s-on-host.tgz:application/vnd.devcontainers.collection.layer.v1+json" | ||
oras push ${{ env.REGISTRY }}/microsoft/devcontainers/features/k3s-on-host:latest \ | ||
--config /dev/null:application/vnd.devcontainers \ | ||
./output/devcontainer-feature-k3s-on-host.tgz:application/vnd.devcontainers.collection.layer.v1+json | ||
sub_exit_code=${PIPESTATUS[0]} | ||
if [[ $sub_exit_code -gt 0 ]]; then | ||
echo "Previous step failed. Troubleshoot" | ||
exit 1 | ||
fi |