Skip to content

Commit

Permalink
Update CI to be ECR-only
Browse files Browse the repository at this point in the history
`PREFIX` is being defaulted, so there's no ECR-specific options for the
build, we just have to remove DockerHub auth and ensure ECR auth.
  • Loading branch information
pbrisbin committed Nov 20, 2024
1 parent c297a02 commit 6d5a0b2
Showing 1 changed file with 12 additions and 34 deletions.
46 changes: 12 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,38 +73,13 @@ jobs:
curl --proto '=https' --tlsv1.2 -sSf \
https://raw.githubusercontent.com/restyled-io/restyler/main/install | sudo sh
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

# Necessary if pushing, but best-effort if pulling (rate limits)
continue-on-error: ${{ github.ref_name != 'main' }}

# TODO: lint

- name: "Build, test, and push (if main) sha-tagged images"
run: >-
restylers
${{ runner.debug && '--debug' || '' }}
--sha ${{ github.sha }}
--write tested.yaml
--no-pull
${{ github.ref_name == 'main' && '--push' || '' }}
${{ needs.changes.outputs.restylers }}
- if: ${{ github.ref_name == 'main' }}
name: AWS Login
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_ROLE }}

- if: ${{ github.ref_name == 'main' }}
id: ecr-login
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

- if: ${{ github.ref_name == 'main' }}
name: Create ECR repositories if necessary
run: |
Expand All @@ -118,19 +93,22 @@ jobs:
done
- if: ${{ github.ref_name == 'main' }}
name: Mirror image to ECR
name: ECR Login
id: ecr-login
uses: aws-actions/amazon-ecr-login@v2
with:
registry-type: public

# TODO: lint

- name: Build, test, and push (if main)
run: >-
restylers
${{ runner.debug && '--debug' || '' }}
--sha ${{ github.sha }}
--write tested.yaml
--no-pull
--no-test
--push
--prefix "$PREFIX"
${{ github.ref_name == 'main' && '--push' || '' }}
${{ needs.changes.outputs.restylers }}
env:
# TODO: use restyled-io alias once available
PREFIX: ${{ steps.ecr-login.outputs.registry }}/${{ vars.AWS_ECR_NAMESPACE }}/
- name: Build merged restylers.yaml
run: |
Expand Down

0 comments on commit 6d5a0b2

Please sign in to comment.