-
Notifications
You must be signed in to change notification settings - Fork 37
67 lines (58 loc) · 1.83 KB
/
docker_deploy.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# -----------------------------------------------------------------------------
# Copyright Helio Chissini de Castro 2023.
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------------
name: Docker Build
on:
push:
paths-ignore:
- "**.md"
tags:
- 'v*'
env:
REGISTRY: ghcr.io
jobs:
docker_push:
name: Build Docker Image
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
steps:
- name: Checkout main repository
uses: actions/checkout@v3
- name: Set environment variables
run: |
echo "ORG_BASE_NAME=${GITHUB_REPOSITORY}" >> $GITHUB_ENV
echo "TOOLS_JAVA_VERSION=${GITHUB_REF_NAME/v/}" >> $GITHUB_ENV
- name: Echoing current version
run: |
echo "$TOOLS_JAVA_VERSION"
echo $GITHUB_REF_NAME
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract components metadata
id: meta_base
uses: docker/metadata-action@v4
with:
images: |
${{ env.REGISTRY }}/${{ env.ORG_BASE_NAME }}/tools-java
- name: Build Container
uses: docker/build-push-action@v3
with:
context: .
push: true
load: false
build-args: |
TOOLS_JAVA_VERSION=${{ env.TOOLS_JAVA_VERSION }}
tags: |
${{ steps.meta_base.outputs.tags }}
labels: ${{ steps.meta_base.outputs.labels }}
cache-from: type=gha,scope=tools_java
cache-to: type=gha,scope=tools_java,mode=max