-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (36 loc) · 1.07 KB
/
docker-image.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
37
38
39
40
41
42
43
name: Moogly build and push
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
REGISTRY: docker.io
IMAGE_NAME: ${{ secrets.DOCKER_USERNAME }}/moogly
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- id: string
uses: ASzc/change-string-case-action@v2
with:
string: ${{ env.IMAGE_NAME }}
- name: Generate random tag
id: random_tag
run: echo "tag=$(openssl rand -hex 6)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:${{ env.tag }}, ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:latest