Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,42 @@ jobs:
runs-on: ubuntu-latest
env:
HTTP_CLI_VERSION: v1.1.0
# Push to registries only on pushes to branches, never on pull_request
# events. Pull requests (especially Dependabot's) cannot read the repo
# secrets needed to authenticate, so they build for validation only.
PUSH: ${{ github.event_name != 'pull_request' }}
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Configure AWS credentials
if: github.event_name != 'pull_request'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Log in to Public ECR
if: github.event_name != 'pull_request'
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- name: Build and push base
run: |
echo "${{ secrets.GHCR_PAT }}" > github_token
if [ "${{ env.PUSH }}" = "true" ]; then
echo "${{ secrets.GHCR_PAT }}" > github_token
OUTPUT_FLAG="--push"
else
# No secrets available on PRs; dummy secret file so the --secret
# mount resolves, and build without pushing.
echo "" > github_token
OUTPUT_FLAG="--output=type=cacheonly"
fi
docker buildx build \
--platform linux/arm64,linux/amd64 \
--provenance=false \
Expand All @@ -53,7 +68,7 @@ jobs:
--target base \
--tag ghcr.io/${{ github.repository_owner }}/lambda-shell-runtime:base \
--tag public.ecr.aws/l9f6r9f5/lambda-shell-runtime:base \
--push \
$OUTPUT_FLAG \
.
env:
GITHUB_TOKEN: ${{ secrets.GHCR_PAT }}
Expand Down Expand Up @@ -119,14 +134,17 @@ jobs:
fi
echo "Detected VERSION: $VERSION"
- name: Configure AWS credentials
if: github.event_name != 'pull_request'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Log in to GHCR
if: github.event_name != 'pull_request'
run: echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u skunxicat --password-stdin
- name: Log in to Public ECR
if: github.event_name != 'pull_request'
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- name: Build and push images
run: |
Expand Down
Loading