Install cwebp on Heroku through the apt buildpack #94
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # A deploy only ever ships the tip of main, so a run that a newer push has | |
| # already superseded is of no use. | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| name: Deploy to Heroku | |
| runs-on: ubuntu-24.04 | |
| if: github.repository == 'freeCodeCamp/devdocs' | |
| steps: | |
| - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 | |
| with: | |
| fetch-depth: 0 # Heroku rejects shallow pushes | |
| - name: Install libwebp tools | |
| run: sudo apt-get update && sudo apt-get install -y webp | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0 | |
| with: | |
| bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
| - name: Run tests | |
| run: bundle exec rake | |
| - name: Install Heroku CLI | |
| run: | | |
| curl https://cli-assets.heroku.com/install.sh | sh | |
| - name: Deploy to Heroku | |
| env: | |
| HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
| run: | | |
| heroku --version | |
| heroku stack:set heroku-26 --app devdocs | |
| # `rake assets:precompile` needs the cwebp of the Aptfile, which the | |
| # apt buildpack puts on the PATH of the ones that follow it. | |
| heroku buildpacks:clear --app devdocs | |
| heroku buildpacks:add heroku-community/apt --app devdocs | |
| heroku buildpacks:add heroku/ruby --app devdocs | |
| heroku git:remote --app devdocs | |
| # no --force; --force should never be necessary | |
| git push heroku HEAD:main |