@karrtikr this is what I use, which might not help you since I use cake build at the tail end:
.github/workflows/build.yml
:
name: Build
on:
push:
branches:
- "**"
- "!dependabot/**"
pull_request:
branches:
- master
repository_dispatch:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-east-1
NUGET_USERNAME: pharos
NUGET_PASSWORD: ${{ secrets.PACKAGES_PAT }}
NUGET_SOURCE: https://nuget.pkg.github.com/pharos/index.json
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
jobs:
Docker:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache packages
uses: actions/cache@v2
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-${{ hashFiles('.config/dotnet-tools.json', '**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Patch config
shell: pwsh
run: ./NuGet.ps1 NuGet.config github pharos ${{ secrets.PACKAGES_PAT }}
- name: ECR login
uses: aws-actions/amazon-ecr-login@v1
- name: Docker pull
run: docker pull <id>.dkr.ecr.us-east-1.amazonaws.com/pharos/build/cake-docker:latest
- name: Cake build
uses: ./.github/actions/cake-build
.github/actions/cake-build/action.yml
:
name: Cake build
runs:
using: docker
image: docker://<id>.dkr.ecr.us-east-1.amazonaws.com/pharos/build/cake-docker:latest
args: [ "bash", "-c", "dotnet tool restore && dotnet cake --bootstrap --verbosity=verbose && dotnet cake --verbosity=verbose --target=build --publish=true" ]
In summary:
- Login to aws ecr private repo (using aws env vars)
- Pull docker image from aws ecr private repo (note: redacted id)
- Run “local action” using git repo relative reference (
./.github/actions/cake-build
)
- Bash command is subsequently run inside a container using previously pulled docker image
- … In this case the remaining steps are handled by cake build