In the new GitHub Actions, I am trying to install a package in order to use it in one of the next steps.
name: CI
on: [push, pull_request]
jobs:
translations:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Install xmllint
run: apt-get install libxml2-utils
# ...
However this fails with
Run apt-get install libxml2-utils
apt-get install libxml2-utils
shell: /bin/bash -e {0}
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
##[error]Process completed with exit code 100.
What's the best way to do this? Do I need to reach for Docker?
With GitHub Actions, you can trigger CI/CD workflows and pipelines of webhooks from these apps (even something simple, like a chat app message, if you've integrated your chat app into your GitHub repository, of course).
The apt-get command is a full-featured but simplified interface to dpkg , and apt is a more user-friendly but slightly stripped-back version of apt-get .
The sudo apt-get upgrade command downloads and installs the updates for each outdated package and dependency on your system. But just running sudo apt-get upgrade will not automatically upgrade the outdated packages – you'll still have a chance to review the changes and confirm that you want to perform the upgrades.
You can install packages as part of your CI flow using GitHub Actions. For example, you could configure a workflow so that anytime a developer pushes code to a pull request, the workflow resolves dependencies by downloading and installing packages hosted by GitHub Packages. Then, the workflow can run CI tests that require the dependencies.
Running a workflow 1 On GitHub, navigate to the main page of the repository. 2 Under your repository name, click Actions . 3 In the left sidebar, click the workflow you want to run. 4 Above the list of workflow runs, select Run workflow . 5 Use the Branch dropdown to select the workflow's branch, and type the input parameters. Click Run workflow .
For more information, see " GitHub's products ." GitHub Actions help you automate your software development workflows in the same place you store code and collaborate on pull requests and issues. You can write individual tasks, called actions, and combine them to create a custom workflow.
They also support many third-party integrations to automate your CD operations. But as long as your automated workflows don’t contain jobs that need third party plugins and services, GitHub Actions is the ideal choice for you. What we have discussed in this tutorial is just the tip of the iceberg.
The docs say:
The Linux and macOS virtual machines both run using passwordless
sudo
. When you need to execute commands or install tools that require more privileges than the current user, you can usesudo
without needing to provide a password.
So simply doing the following should work:
- name: Install xmllint
run: sudo apt-get install -y libxml2-utils
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With