-
Notifications
You must be signed in to change notification settings - Fork 367
41 lines (38 loc) · 1.35 KB
/
push-container.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
name: Push container
on:
workflow_call:
inputs:
package:
required: true
type: string
run-cmd:
required: true
type: string
tags:
required: true
type: string
jobs:
push-container:
runs-on: ubuntu-latest
env:
CAN_PUSH: ${{ secrets.DOCKER_PASSWORD != '' && secrets.DOCKER_USERNAME != '' }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: actions/setup-node@v3
with:
node-version: '18.x'
- uses: docker/login-action@v3
if: env.CAN_PUSH == 'true'
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push container
env:
PUSH: ${{ (env.CAN_PUSH == 'true') && '--push' || '' }}
run: |
echo "Building: '${{ inputs.package }}'"
echo "Tags: ${{ inputs.tags }}"
npm i
npm run ${{ inputs.run-cmd }}
docker buildx build -f packages/${{ inputs.package }}/Dockerfile --platform linux/amd64 ${{ inputs.tags }} . --no-cache ${{ env.PUSH }}