forked from chainguard-dev/registry-redirect
-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (70 loc) · 2.46 KB
/
checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Checks
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint-test:
name: Lint & Test
runs-on: dagger-g2-v0-13-4-2c
steps:
- uses: actions/checkout@v4
- name: Lint
run: |
dagger call -m ./ci --source . lint stdout
- name: Test
run: |
dagger call -m ./ci --source . test stdout
publish:
name: Publish to ECR
runs-on: dagger-g2-v0-13-4-2c
if: github.ref_name == 'main'
steps:
- uses: actions/checkout@v4
- id: install-aws-cli
uses: unfor19/install-aws-cli-action@v1
with:
version: 2
verbose: false
arch: amd64
- name: Configure AWS credentials
id: creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Login ECR
id: login-ecr
run: |
export ECR_TOKEN="$(aws ecr get-login-password)"
echo "token=$ECR_TOKEN" >> $GITHUB_OUTPUT
- name: Publish
env:
ECR_TOKEN: ${{ steps.login-ecr.outputs.token }}
ECR_REGISTRY: 125635003186.dkr.ecr.us-east-1.amazonaws.com
ECR_REPO: dagger-registry
run: |
dagger call -m ./ci --source . build with-registry-auth --address $ECR_REGISTRY --secret env:ECR_TOKEN --username AWS publish --address "$ECR_REGISTRY/$ECR_REPO:${{ github.sha }}"
- name: "Update dagger registry deployment"
env:
DAGGER_CI_GITHUB_TOKEN: ${{ secrets.DAGGER_CI_GITHUB_TOKEN }}
ECR_REGISTRY: "125635003186.dkr.ecr.us-east-1.amazonaws.com"
ECR_REPOSITORY: dagger-registry
IMAGE_TAG: ${{ github.sha }}
DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}
run: |
dagger call -m github.com/matipan/daggerverse/image-updater update \
--repo github.com/dagger/dagger.io \
--branch main \
--files "infra/prod/eks-2024-01-30/argocd/dagger-registry/deployment.yaml" \
--containers 0 \
--image-url "$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" \
--git-user "dagger-ci[bot]" \
--git-email "[email protected]" \
--git-password env:DAGGER_CI_GITHUB_TOKEN \
--app-name "Dagger Registry" \
--force-with-lease