-
Notifications
You must be signed in to change notification settings - Fork 2
86 lines (74 loc) · 2.44 KB
/
ballerina-interpreter.yml
File metadata and controls
86 lines (74 loc) · 2.44 KB
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
80
81
82
83
84
85
86
name: Ballerina Interpreter CI
on:
push:
branches: [main, dev]
paths:
- 'ballerina-interpreter/**'
- '.github/workflows/ballerina-interpreter.yml'
pull_request:
branches: [main, dev]
paths:
- 'ballerina-interpreter/**'
- '.github/workflows/ballerina-interpreter.yml'
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ballerina-interpreter
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.3
with:
version: 2201.12.10
- name: Build
run: bal build
- name: Run tests
run: bal test
docker:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
packages: write
defaults:
run:
working-directory: ballerina-interpreter
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Determine image name
id: meta
env:
OWNER: ${{ github.repository_owner }}
run: |
# GHCR requires lowercase repository names
OWNER_LOWER=$(echo "$OWNER" | tr '[:upper:]' '[:lower:]')
echo "image_name=ghcr.io/$OWNER_LOWER/afm-ballerina-interpreter" >> $GITHUB_OUTPUT
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ballerina-interpreter
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.meta.outputs.image_name }}:latest
${{ steps.meta.outputs.image_name }}:${{ github.sha }}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.title=AFM Ballerina Interpreter
org.opencontainers.image.licenses=Apache-2.0
annotations: |
index:org.opencontainers.image.source=https://github.com/${{ github.repository }}
index:org.opencontainers.image.licenses=Apache-2.0