diff --git a/.github/workflows/build-and-release.yaml b/.github/workflows/build-and-release.yaml new file mode 100644 index 0000000..983cf76 --- /dev/null +++ b/.github/workflows/build-and-release.yaml @@ -0,0 +1,62 @@ +name: Build and Publish Jsonnet + +on: + workflow_dispatch: + inputs: + version: + description: "Jsonnet Version" + required: true + default: "v0.20.0" + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/arm64 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build image + run: | + docker buildx build \ + --load \ + --platform ${{ matrix.platform }} \ + --build-arg JSONNET_REPO_TAG=${{ github.event.inputs.version }} \ + --tag jsonnet:local \ + . + + - name: Create container + run: | + docker create --name temp_container jsonnet:local + + - name: Setup assets name + id: assets + run: | + version='${{ github.event.inputs.version }}' + platform=$(echo '${{ matrix.platform }}' | tr '/' '-') + echo "archive_name=jsonnet-${version}-${platform}.tar.gz" >> $GITHUB_OUTPUT + + - name: Copy jsonnet binaries from Docker container + id: binaries + run: | + docker cp temp_container:/workdir/jsonnet ./jsonnet + docker cp temp_container:/workdir/jsonnetfmt ./jsonnetfmt + tar -czvf ${{ steps.assets.outputs.archive_name }} jsonnet jsonnetfmt + + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: ${{ github.event.inputs.version }} + tag_name: ${{ github.event.inputs.version }} + files: ${{ steps.assets.outputs.archive_name }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c55cfd4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:3.10.3 AS jsonnet_builder +WORKDIR /workdir +ARG JSONNET_REPO_TAG='v0.20.0' +RUN apk -U add build-base git \ + && git clone --depth 1 --branch "${JSONNET_REPO_TAG}" https://github.com/google/jsonnet . \ + && export LDFLAGS=-static \ + && make diff --git a/README.md b/README.md new file mode 100644 index 0000000..2599d78 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# jsonnet +Static compiled jsonnet binaries