-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #726 from rstudio/dev
Dev to Main
- Loading branch information
Showing
98 changed files
with
3,623 additions
and
2,612 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
name: 'Build/Test/Scan/Push Image' | ||
inputs: | ||
target: | ||
description: Target or group to bake | ||
required: true | ||
type: string | ||
bakefile: | ||
description: Path to the bakefile | ||
required: true | ||
default: "docker-bake.hcl" | ||
type: string | ||
env-vars: | ||
description: A semicolon delimited list of environment variables to set as overrides for the bake definition | ||
required: false | ||
type: string | ||
test-image: | ||
description: Flag to test image once built | ||
default: true | ||
type: boolean | ||
push-image: | ||
description: Flag to push image once built | ||
default: false | ||
type: boolean | ||
ghcr-token: | ||
description: Username for authentication with GHCR.io | ||
required: true | ||
type: string | ||
dockerhub-username: | ||
description: Username for authentication with DockerHub | ||
required: true | ||
type: string | ||
dockerhub-token: | ||
description: Username for authentication with DockerHub | ||
required: true | ||
type: string | ||
gcp-json: | ||
description: JSON for authenticating Google Cloud Platform | ||
default: "" | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
# Setup dependencies and tools | ||
- name: Set up Just | ||
uses: extractions/setup-just@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ inputs.ghcr-token }} | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
# Authenticate to registries | ||
- name: Login to ghcr.io | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ inputs.ghcr-token }} | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ inputs.dockerhub-username }} | ||
password: ${{ inputs.dockerhub-token }} | ||
|
||
- name: Login to GCAR us-central1 | ||
continue-on-error: true | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: us-central1-docker.pkg.dev | ||
username: _json_key | ||
password: '${{ inputs.gcp-json }}' | ||
|
||
- name: Login to GCAR us | ||
continue-on-error: true | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: us-docker.pkg.dev | ||
username: _json_key | ||
password: '${{ inputs.gcp-json }}' | ||
|
||
- name: Login to GCAR asia | ||
continue-on-error: true | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: asia-docker.pkg.dev | ||
username: _json_key | ||
password: '${{ inputs.gcp-json }}' | ||
|
||
- name: Login to GCAR europe | ||
continue-on-error: true | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: europe-docker.pkg.dev | ||
username: _json_key | ||
password: '${{ inputs.gcp-json }}' | ||
|
||
# Build, test, and push image | ||
- name: Build | ||
id: build | ||
uses: docker/bake-action@v4 | ||
with: | ||
targets: "${{ inputs.target }}" | ||
push: false | ||
files: ${{ inputs.bakefile }} | ||
|
||
- name: Test | ||
shell: bash | ||
run: | | ||
just test "${{ inputs.target }}" "${{ inputs.bakefile }}" | ||
- name: Push - ${{ inputs.push-image }} | ||
uses: docker/bake-action@v4 | ||
with: | ||
targets: "${{ inputs.target }}" | ||
push: ${{ inputs.push-image }} | ||
files: ${{ inputs.bakefile }} |
Oops, something went wrong.