https://github.com/peaceiris/actions-export-envs
Exporting ACTIONS_RUNTIME_TOKEN and ACTIONS_CACHE_URL to enable the Docker layer caching on GitHub Actions.
https://github.com/peaceiris/actions-export-envs
Last synced: about 1 year ago
JSON representation
Exporting ACTIONS_RUNTIME_TOKEN and ACTIONS_CACHE_URL to enable the Docker layer caching on GitHub Actions.
- Host: GitHub
- URL: https://github.com/peaceiris/actions-export-envs
- Owner: peaceiris
- License: mit
- Created: 2022-12-06T07:06:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-14T21:52:54.000Z (over 1 year ago)
- Last Synced: 2025-05-28T20:08:06.133Z (about 1 year ago)
- Language: Shell
- Homepage:
- Size: 34.2 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# actions-export-envs
This action exports `ACTIONS_RUNTIME_TOKEN` and `ACTIONS_CACHE_URL` to enable the Docker layer caching on GitHub Actions.
cf. [GitHub Actions cache | Docker Documentation](https://docs.docker.com/build/building/cache/backends/gha/)
## Usage
Example:
```Makefile
DOCKER_CLI_EXPERIMENTAL := enabled
DOCKER_BUILDKIT := 1
DOCKER_SCOPE := action-image-${GITHUB_REF_NAME}
PKG_NAME := ghcr.io/peaceiris/actions-export-envs:latest
.PHONY: setup-buildx
setup-buildx:
docker buildx create --use --driver docker-container
.PHONY: build
build: setup-buildx
docker buildx build . \
--tag "${PKG_NAME}" \
--platform "linux/amd64" \
--output "type=docker" \
--cache-from "type=gha,scope=${DOCKER_SCOPE}" \
--cache-to "type=gha,mode=max,scope=${DOCKER_SCOPE}"
```
https://github.com/peaceiris/actions-export-envs/blob/31e89d21c33421aee2c7780a6391715be3dd901a/Makefile#L12-L19
```yaml
name: CI
on:
push:
pull_request:
jobs:
main:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: peaceiris/actions-export-envs@v1.1.0
id: envs
- run: make build
env:
ACTIONS_RUNTIME_TOKEN: ${{ steps.envs.outputs.ACTIONS_RUNTIME_TOKEN }}
ACTIONS_CACHE_URL: ${{ steps.envs.outputs.ACTIONS_CACHE_URL }}
```
https://github.com/peaceiris/actions-export-envs/blob/31e89d21c33421aee2c7780a6391715be3dd901a/.github/workflows/ci.yml#L48-L54