Skip to content

Commit

Permalink
Km/adding action (#4)
Browse files Browse the repository at this point in the history
* 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
KevinDMack and Kevin Mack authored Jun 10, 2024
1 parent 06dc53b commit d84a007
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/feature.yml
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

0 comments on commit d84a007

Please sign in to comment.