-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (65 loc) · 2.25 KB
/
docker.yaml
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
name: Build and Upload Docker Images
run-name: Build and Upload ${{ inputs.package }} Docker Image
on:
workflow_call:
inputs:
package:
required: true
type: string
registry:
required: true
type: string
jobs:
docker-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- run: env
- run: |
echo ${{ inputs.registry }}
echo ${{ github.repository }}
echo ${{ inputs.package }}
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- run: npm ci -w packages/${{ inputs.package }}
- name: Package build
env:
DISABLE_ESLINT_PLUGIN: true
run: npm run build -w packages/${{ inputs.package }}
- id: get-version
name: Get ${{ inputs.package }} Version
run: |
VERSION=$(node -p "require('./packages/${{ inputs.package }}/package.json').version")
echo "package_version=$VERSION"
echo "package_version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Docker registry login
uses: docker/login-action@v3
with:
registry: ${{ inputs.registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ inputs.registry }}/${{ github.repository }}-${{ inputs.package }}
labels: |
org.opencontainers.image.version=${{ steps.get-version.outputs.package_version }}
org.opencontainers.image.title=${{ github.repository }}-${{ inputs.package }}
tags: |
type=semver,pattern={{version}},value=${{ steps.get-version.outputs.package_version }}
- name: DELETE ME LATER
run: |
ls -l ./packages/${{ inputs.package }}/
- name: Docker Build and Push
uses: docker/build-push-action@v5
with:
context: ./packages/${{ inputs.package }}/
file: ./packages/${{ inputs.package }}/Dockerfile
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}