From b7fcf137abad96cde6074f3f81346eef3ff49036 Mon Sep 17 00:00:00 2001 From: Casey Lee Date: Mon, 9 Mar 2020 17:49:55 -0700 Subject: [PATCH] Fix 132 - support for chocolatey install (#144) * fix #132 - publish chocolatey package for act * add missing files to pass validation * remove extra choco step --- .github/actions/choco/Dockerfile | 34 +++++++++++++++++++++++++++++ .github/actions/choco/action.yml | 12 ++++++++++ .github/actions/choco/entrypoint.sh | 29 ++++++++++++++++++++++++ .github/workflows/push.yml | 5 +++++ .gitignore | 4 +++- README.md | 4 +++- VERIFICATION | 5 +++++ act-cli.nuspec | 26 ++++++++++++++++++++++ 8 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 .github/actions/choco/Dockerfile create mode 100644 .github/actions/choco/action.yml create mode 100755 .github/actions/choco/entrypoint.sh create mode 100644 VERIFICATION create mode 100644 act-cli.nuspec diff --git a/.github/actions/choco/Dockerfile b/.github/actions/choco/Dockerfile new file mode 100644 index 00000000..678e0925 --- /dev/null +++ b/.github/actions/choco/Dockerfile @@ -0,0 +1,34 @@ + +FROM mono:3.12.1 as builder +ARG CHOCOVERSION=0.10.15 + +RUN echo "deb http://archive.debian.org/debian/ wheezy main contrib non-free" >/etc/apt/sources.list +RUN apt-get update && apt-get install -y wget tar gzip + +WORKDIR /usr/local/src +RUN wget "https://github.com/chocolatey/choco/archive/${CHOCOVERSION}.tar.gz" +RUN tar -xzf "${CHOCOVERSION}.tar.gz" +RUN mv "choco-${CHOCOVERSION}" choco + +WORKDIR /usr/local/src/choco +RUN chmod +x build.sh zip.sh +RUN ./build.sh -v + +FROM alpine:latest + +COPY --from=builder /usr/local/src/choco/build_output/chocolatey /opt/chocolatey + +RUN apk add --no-cache bash +RUN apk --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing add mono-dev \ + && apk --update --no-cache add -t build-dependencies ca-certificates \ + && cert-sync /etc/ssl/certs/ca-certificates.crt \ + && ln -sf /opt /opt/chocolatey/opt \ + && mkdir -p /opt/chocolatey/lib \ + && apk del build-dependencies \ + && rm -rf /var/cache/apk/* + + +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + + diff --git a/.github/actions/choco/action.yml b/.github/actions/choco/action.yml new file mode 100644 index 00000000..33cc3c6f --- /dev/null +++ b/.github/actions/choco/action.yml @@ -0,0 +1,12 @@ +name: 'Chocolatey Packager' +description: 'Create the choco package and push it' +inputs: + version: + description: 'Version of package' + required: true + apiKey: + description: 'API Key for chocolately' + required: true +runs: + using: 'docker' + image: 'Dockerfile' diff --git a/.github/actions/choco/entrypoint.sh b/.github/actions/choco/entrypoint.sh new file mode 100755 index 00000000..7048395b --- /dev/null +++ b/.github/actions/choco/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -e + +function choco { + mono /opt/chocolatey/choco.exe "$@" --allow-unofficial --nocolor +} + +function get_version { + local version=${INPUT_VERSION:-$(git describe --tags)} + version=(${version//[!0-9.-]/}) + local version_parts=(${version//-/ }) + version=${version_parts[0]} + if [ ${#version_parts[@]} -gt 1 ]; then + version=${version_parts}.${version_parts[1]} + fi + echo "$version" +} + +## Determine the version to pack +VERSION=$(get_version) +echo "Packing version ${VERSION} of act" +rm -f act-cli.*.nupkg +mkdir -p tools +cp LICENSE tools/LICENSE.txt +cp VERIFICATION tools/VERIFICATION.txt +cp dist/act_windows_amd64/act.exe tools/ +choco pack act-cli.nuspec --version ${VERSION} +choco push act-cli.${VERSION}.nupkg --api-key ${INPUT_APIKEY} -s https://push.chocolatey.org/ --timeout 180 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 68f64b96..c8e5a0e2 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -38,3 +38,8 @@ jobs: args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} + - name: Chocolatey + uses: ./.github/actions/choco + with: + version: ${{ github.ref }} + apiKey: ${{ secrets.CHOCO_APIKEY }} diff --git a/.gitignore b/.gitignore index 8f1d947a..2fbedf41 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ *.out dist/ -.todo \ No newline at end of file +.todo + +*.nupkg diff --git a/README.md b/README.md index bdf29cde..cef37edb 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,9 @@ Alternatively, you can use the following: ```curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash``` -If you are running Windows, download the [latest release](https://github.com/nektos/act/releases/latest) and add the binary in to your PATH. +If you are running Windows, download the [latest release](https://github.com/nektos/act/releases/latest) and add the binary in to your PATH. If you are using [Chocolatey](https://chocolatey.org/) then run: + +```choco install act-cli``` If you are running Arch Linux, you can install the [act](https://aur.archlinux.org/packages/act/) package with your favorite package manager: diff --git a/VERIFICATION b/VERIFICATION new file mode 100644 index 00000000..ea5b1a9c --- /dev/null +++ b/VERIFICATION @@ -0,0 +1,5 @@ +VERIFICATION +Verification is intended to assist the Chocolatey moderators and community +in verifying that this package's contents are trustworthy. + +Checksums: https://github.com/nektos/act/releases, in the checksums.txt file diff --git a/act-cli.nuspec b/act-cli.nuspec new file mode 100644 index 00000000..1a48927b --- /dev/null +++ b/act-cli.nuspec @@ -0,0 +1,26 @@ + + + + + act-cli + 0.0.0 + https://github.com/nektos/act + nektos + act (GitHub Actions CLI) + nektos + https://github.com/nektos/act + https://raw.githubusercontent.com/wiki/nektos/act/img/logo-150.png + Nektos + https://raw.githubusercontent.com/nektos/act/master/LICENSE + true + https://github.com/nektos/act + https://raw.githubusercontent.com/nektos/act/master/README.md + https://github.com/nektos/act/issues + act github-actions actions golang ci devops + Run your GitHub Actions locally ๐Ÿš€ + Run your GitHub Actions locally ๐Ÿš€ + + + + +