GitHub CLI 2.0 includes extensions, allowing you to create and share custom commands to improve your GitHub workflows.
Learn more about GitHub CLI, and check out the blog post and detailed release notes to learn more about this release.
You can now run Java projects faster on GitHub Actions by enabling dependency caching on the setup-java action. setup-java
supports caching for both Gradle and Maven projects.
The following example enables caching for a Java project with Gradle:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- run: ./gradlew build
For additional examples, visit the setup-java repository.
GitHub CLI 2.0 includes extensions, allowing you to create and share custom commands to improve your GitHub workflows.
Learn more about GitHub CLI, and check out the blog post and detailed release notes to learn more about this release.
Previously, actions written in YAML could only use scripts. Now, they can also reference other actions. This makes it easy to reduce duplication in your workflows.
For example, the following action uses 3 actions to setup buildx, log in to Docker, and publish an image. By combining these into a single action it provides a larger unit of reuse that you can put into the job of any workflow.
name: "Publish to Docker"
description: "Pushes built artifacts to Docker"
inputs:
registry_username:
description: “Username for image registry”
required: true
registry_password:
description: “Password for image registry”
required: true
runs:
using: "composite"
steps:
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
username: ${{inputs.registry_username}}
password: ${{inputs.registry_password}}
- uses: docker/build-push-action@v2
with:
context: .
push: true
tags: user/app:latest
Developers can then reference this action in all of their repositories as a single action:
on: [push]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: my-org/publish-docker@v1
with:
registry_username: ${{secrets.REGISTRY_USERNAME}}
registry_password: ${{secrets.REGISTRY_PASSWORD}}
Learn more about action composition.
For questions, visit the GitHub Actions community