-
-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (33 loc) · 1.7 KB
/
build-single-src.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
# This script builds final runtime image from indimail-docker/indimail-src/srcName.src
name: build-single-src push script
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
srcName:
# Friendly description to be shown in the UI instead of 'name'
source Name: 'src name'
# Input has to be provided for the workflow to run
required: true
jobs:
build_and_push:
name: build and push container image
runs-on: ubuntu-latest
steps:
- name: checkout repository
uses: actions/checkout@v2
- name: build
run: |
if [ -f indimail-src/"${{ github.event.inputs.srcName }}".src ] ; then
echo "Using indimail-src/"${{ github.event.inputs.srcName }}".src for build"
cp indimail-src/"${{ github.event.inputs.srcName }}".src Dockerfile
echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io --username "${{ github.repository_owner }}" --password-stdin
echo "${{ secrets.DOCKER_PAT }}" | docker login docker.io --username cprogrammer --password-stdin
docker build --tag "docker.io/cprogrammer/indimail-src:${{ github.event.inputs.srcName }}" .
docker image tag "docker.io/cprogrammer/indimail-src:${{ github.event.inputs.srcname }}" "ghcr.io/${{ github.repository_owner }}/indimail-src:${{ github.event.inputs.srcname }}"
docker push docker.io/cprogrammer/indimail-src:${{ github.event.inputs.srcName }}
docker push "ghcr.io/${{ github.repository_owner }}/indimail-src:${{ github.event.inputs.srcName }}"
/bin/rm -f Dockerfile
else
echo "indimail-src/"${{ github.event.inputs.srcName }}".src not found"
fi