diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d63e138 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: release + +on: + release: + types: [published] + +jobs: + moon: + runs-on: ubuntu-latest + if: github.repository == 'aerokube/boot' + steps: + - uses: actions/checkout@v3 + + - name: Prepare release version + run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV + + - name: Download and extract release + run: ci/extract.sh $RELEASE_VERSION + + - uses: AButler/upload-release-assets@v2.0 + with: + files: 'dist/*' + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67903c9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +dist/* +.idea diff --git a/ci/extract.sh b/ci/extract.sh new file mode 100755 index 0000000..514c321 --- /dev/null +++ b/ci/extract.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +VERSION=$1 + +mkdir -p dist +cd dist +for osArch in "linux/amd64" "darwin/amd64" "darwin/arm64" "windows/amd64"; do + os=$(echo "$osArch" | awk -F "_" '{print $1;}') + arch=$(echo "$osArch" | awk -F "_" '{print $2;}') + zipFile='kubectl-vm_'"$VERSION"'_'"$osArch.zip" + downloadURL="https://download.aerokube.com/boot/kubectl-vm/$VERSION/$zipFile" + outputFile='kubectl-vm_'"$os"'_'"$arch" + if [ "$os" == "windows" ]; then + outputFile="$outputFile.exe" + fi + curl -s "$downloadURL" | zcat >> "$outputFile" + chmod 755 "$outputFile" +done