Skip to content

Commit 8a5763a

Browse files
committed
Add workflow to build dotty-ci
1 parent 9b2e878 commit 8a5763a

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

Diff for: .github/workflows/dotty-ci-container.yaml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Build & Deploy the CI image for Dotty
2+
on:
3+
## Trigger this workflow when a change is detected in the Dockerfile
4+
## or in the following file
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- .github/Dockerfile
10+
- .github/workflows/dotty-ci-container.yaml
11+
pull_request:
12+
paths:
13+
- .github/Dockerfile
14+
- .github/workflows/dotty-ci-container.yaml
15+
16+
concurrency:
17+
group: dotty-ci-build
18+
cancel-in-progress: false
19+
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
env:
25+
##REGISTRY: ghcr.io
26+
IMAGE_NAME: ${{ github.repository }}/dotty-ci
27+
28+
jobs:
29+
build_and_deploy:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout the repository
33+
uses: actions/checkout@v4
34+
- uses: docker/setup-buildx-action@v3
35+
#- name: Log in to the registry
36+
# uses: docker/login-action@v3
37+
# with:
38+
# registry: ${{ env.REGISTRY }}
39+
# username: ${{ github.actor }}
40+
# password: ${{ secrets.GITHUB_TOKEN }}
41+
- name: Extract metadata for the image
42+
uses: docker/metadata-action@v5
43+
id: metadata
44+
with:
45+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+
## TODO: Should we use the short SHA instead?
47+
tags: |
48+
type=schedule,pattern={{date 'YYYY-MM-DD'}}
49+
## Build when triggered by a pull_request
50+
- name: Build the image
51+
uses: docker/build-push-action@v5
52+
if: github.event_name == 'pull_request'
53+
with:
54+
context: .github
55+
push: false
56+
tags: ${{ steps.metadata.outputs.tags }}
57+
labels: ${{ steps.metadata.outputs.labels }}
58+
platforms: linux/amd64
59+
## Build and push when triggered by a push to the default branch
60+
- name: Build and push the image
61+
uses: docker/build-push-action@v5
62+
if: github.event_name == 'push'
63+
with:
64+
context: .github
65+
push: true
66+
tags: ${{ steps.metadata.outputs.tags }}
67+
labels: ${{ steps.metadata.outputs.labels }}
68+
platforms: linux/amd64

0 commit comments

Comments
 (0)