Code Monkey home page Code Monkey logo

ghaction-chocolatey's Introduction

GitHub release GitHub marketplace CI workflow Become a sponsor Paypal Donate

About

GitHub Action for Chocolatey, the package manager for Windows.

GitHub Action for Chocolatey


Usage

on: push

jobs:
  test:
    runs-on: windows-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
      -
        name: Choco help
        uses: crazy-max/ghaction-chocolatey@v3
        with:
          args: -h

Customizing

inputs

Following inputs can be used as step.with keys

Name Type Description
args String Arguments to pass to Chocolatey
image String Docker image to use (default ghcr.io/crazy-max/ghaction-chocolatey)

Limitation

This action is only available for Linux and Windows virtual environments.

Contributing

Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You can also support this project by becoming a sponsor on GitHub or by making a PayPal donation to ensure this journey continues indefinitely!

Thanks again for your support, it is much appreciated! ๐Ÿ™

License

MIT. See LICENSE for more details.

ghaction-chocolatey's People

Contributors

crazy-max avatar dependabot-preview[bot] avatar dependabot[bot] avatar github-actions[bot] avatar regg00 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ghaction-chocolatey's Issues

Could not find part of the path 'wksp/tools'

Behaviour

Attempting to automatically create a chocolatey package of my command line tool using GitHub Actions.

Expected behaviour

pack command should create .nupkg file

Actual behaviour

Get this error: Could not find a part of the path '/wksp/tools'.

Configuration

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm ci
    - run: npm i -g pkg
    - run: npm run-script build --if-present
    - uses: actions/upload-artifact@v2
      with:
        name: binaries
        path: /home/runner/work/node-rename-cli/node-rename-cli/bin
    - run: npm run-script chocolatey --if-present
    - run: ls chocolatey/rename-cli/tools/
    - name: Choco package
      uses: crazy-max/ghaction-chocolatey@v1
      with:
        args: pack chocolatey/rename-cli/rename-cli.nuspec

Logs

Download the log file of your build and attach it to this issue.

logs_25.zip

How to install a package

Maybe I'm wrong but you pass any arg to Chocolatey using this GH Action. So I'm trying to install a package passing the args install docfx.

- name: Choco install docfx
        uses: crazy-max/ghaction-chocolatey@v1
        with:
          args: install docfx

The output:

Chocolatey v0.10.15.0
Directory 'opt/chocolatey/lib' does not exist.
Could not find a command registered that meets 'install docfx'. 
 Try choco -? for command reference/help.

The same command in my local environment:

ฮป choco install docfx
Chocolatey v0.10.8
Chocolatey detected you are not running from an elevated command shell
 (cmd/powershell).

 You may experience errors - many functions/packages
 require admin rights. Only advanced users should run choco w/out an
 elevated shell. When you open the command shell, you should ensure
 that you do so with "Run as Administrator" selected. If you are
 attempting to use Chocolatey in a non-administrator setting, you
 must select a different location other than the default install
 location. See
 https://chocolatey.org/install#non-administrative-install for details.


 Do you want to continue?([Y]es/[N]o): Y

NuGet vs Choco package version mismatch?

Behaviour

Steps to reproduce this issue

  1. Pack Software
  2. Push Software

Expected behaviour

Software packed succesfully

Actual behaviour

Despite version being 0.7.4.0, package gets packed as 0.7.4 causing a file not found error later in the process

image

Configuration

name: Chocolatey Deploy

on:
  release:
    types: [published]
  workflow_dispatch:

defaults:
  run:
    shell: bash

jobs:
  chocolatey:
    name: Deploy
    runs-on: windows-latest
    if: github.repository == 'rcmaehl/MSEdgeRedirect'
    steps:
      - name: Clone Repository
        uses: actions/checkout@v3
      - uses: oprypin/find-latest-tag@v1
        with:
          repository: rcmaehl/MSEdgeRedirect  # The repository to scan.
          releases-only: true  # We know that all relevant tags have a GitHub release for them.
        id: latesttag
      - name: Set Checksum
        run: |
          filename="MSEdgeRedirect.exe"
          url="https://github.com/${{ github.repository }}/releases/download/${{ steps.latesttag.outputs.tag }}/${filename}"
          sed -i "s#{URL64}#${url}#g" "Assets/Choco/MSEdgeRedirect/tools/chocolateyinstall.ps1"
          curl -sSL "${url}" -o "Assets/Choco/${filename}"
          sha256=$(cat "Assets/Choco/${filename}" | sha256sum -)
          sed -i "s/{SHA256CHECKSUM64}/${sha256:0:64}/g" "Assets/Choco/MSEdgeRedirect/tools/chocolateyinstall.ps1"
      - name: Set Version
        id: version
        run: |
          version=${{ steps.latesttag.outputs.tag }}
          echo "::set-output name=nuget::$version"
          sed -i "s/{VERSION}/${version}/g" "Assets/Choco/MSEdgeRedirect/msedgeredirect.nuspec"
      - name: Pack Release
        uses: crazy-max/[email protected]
        with:
          args: pack Assets/Choco/MSEdgeRedirect/msedgeredirect.nuspec --outputdirectory Assets/Choco/MSEdgeRedirect
      - name: Upload Release
        uses: crazy-max/[email protected]
        with:
          args: push Assets/Choco/MSEdgeRedirect/msedgeredirect.${{ steps.version.outputs.nuget }}.nupkg -s https://push.chocolatey.org/ -k ${{ secrets.CHOCO_KEY }}

Logs

logs_760.zip

Choco action fails with "Root element is missing" Exit code 1

Hi Mr Crazy, I'm having an issue with Choco pack.

Behaviour

Steps to reproduce this issue

  1. Use action to package something

Expected behaviour

Package should build correctly.

Actual behaviour

Package fails to build, Action errors with the following logs:

Run crazy-max/ghaction-chocolatey@v2
  with:
    args: pack
    image: ghcr.io/crazy-max/ghaction-chocolatey
Running choco
  C:\ProgramData\Chocolatey\bin\choco.exe pack --allow-unofficial
  Chocolatey v1.[2](https://github.com/Sierra1011/chocolateypackage-rocketchat/actions/runs/3450798168/jobs/5759604527#step:4:2).0
  Root element is missing.
  Error: The process 'C:\ProgramData\Chocolatey\bin\choco.exe' failed with exit code 1

Configuration

Workflow file is here
Action logs and builds here

Logs

logs_42.zip

Notes

I had a look around and found a repo that built successfully config here, logs here, and this one config here, logs here so I'm not entirely sure what I'm doing wrong.
I've seen some other repos that have Choco.exe runs with exit code 1, but none that I can see the logs of.

GITHUB_TOKEN permissions used by this action

At https://github.com/step-security/secure-workflows we are building a knowledge-base (KB) of GITHUB_TOKEN permissions needed by different GitHub Actions. When developers try to set minimum token permissions for their workflows, they can use this knowledge-base instead of trying to research permissions needed by each GitHub Action they use.

Below you can see the KB of your GITHUB Action.

name: 'Chocolatey Action' # crazy-max/ghaction-chocolatey
# GITHUB_TOKEN not used

If you think this information is not accurate, or if in the future your GitHub Action starts using a different set of permissions, please create an issue at https://github.com/step-security/secure-workflows/issues to let us know.

This issue is automatically created by our analysis bot, feel free to close after reading :)

References:

GitHub asks users to define workflow permissions, see https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/ and https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token for securing GitHub workflows against supply-chain attacks.

Setting minimum token permissions is also checked for by Open Source Security Foundation (OpenSSF) Scorecards. Scorecards recommend using https://github.com/step-security/secure-workflows so developers can fix this issue in an easier manner.

๐Ÿ“– Documentation : How to run a choco step only when getting a TAG

Context

I'm porting a Chcolatey build project from Appveyor to github action. On the Appveyor project, I run the release only when getting a tag.
I'd like to port this to Github Actions

Action

Could you please provide some yaml samples for newbees like me so they could run some choco commands only when gettin a tag ?

Thank you in advance for you help and your Github action. ๐Ÿ™

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.