-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (63 loc) · 2.32 KB
/
release.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
66
67
68
69
70
71
name: Create release and asset
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the develop branch
release:
types:
- published
env:
# Pretty cargo output!
CARGO_TERM_COLOR: always
jobs:
check-docker-secrets:
name: Check if docker hub registry information was set on secrets
runs-on: ubuntu-latest
outputs:
is_have_secrets: ${{ steps.check_secret_job.outputs.is_have_secrets }}
steps:
- id: check_secret_job
run: |
if [[ "${{ secrets.DOCKER_HUB_REPO_NAME }}" != "" && \
"${{ secrets.DOCKER_USERNAME }}" != "" && \
"${{ secrets.DOCKER_TOKEN }}" != "" ]]; \
then
echo "Secrets to use a container registry are configured in the repo"
echo "is_have_secrets=true" >> $GITHUB_OUTPUT
else
echo "Secrets to use a container registry were not configured in the repo"
echo "is_have_secrets=false" >> $GITHUB_OUTPUT
fi
# TODO: Download .tar and add docker image without uncompress
# Publish docker multiarch image in Docker Hub Registry to application
push-imame-dhr:
name: Push docker multiarch image to Docker Hub
needs:
- check-docker-secrets
# Skip step based on secret
if: needs.check-docker-secrets.outputs.is_have_secrets == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
# CONFIGURE DOCKER SECRETS INTO REPOSITORY
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push image in Docker Hub
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64,linux/amd64/v2,linux/arm64/v8
push: true
build-args: |
BUILD_VERSION=${{ github.event.release.tag_name }}
tags: |
${{ secrets.DOCKER_HUB_REPO_NAME }}:${{ github.event.release.tag_name }}
${{ secrets.DOCKER_HUB_REPO_NAME }}