-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (32 loc) · 1.17 KB
/
docker-release.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
---
name: Publish container images to Docker Hub
on: workflow_dispatch # Only triggered manually, must be done from a semantic version tag
jobs:
push_to_registry:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- env:
IMAGE_EDITION: community
IMAGE_SUFFIX:
- env:
IMAGE_EDITION: developer
IMAGE_SUFFIX: -developer
steps:
- uses: actions/checkout@v4
- id: semver
name: Ensure that selected tag is a semantic version
uses: matt-usurp/validate-semver@v2
with:
version: ${{ github.ref }}
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Package and push container to Docker Hub
if: ${{ github.ref_type == "tag" }}
run: |
export CONTAINER_TAG="${{ steps.semver.outputs.version }}${{ matrix.env.IMAGE_SUFFIX }}"
docker build --build-arg="IMAGE_EDITION=${{ matrix.env.IMAGE_EDITION }}" -t ictu/sonar:${CONTAINER_TAG} .
echo "Would run: docker push ictu/sonar:${CONTAINER_TAG}"