-
Notifications
You must be signed in to change notification settings - Fork 7
61 lines (54 loc) · 1.66 KB
/
docker.yml
File metadata and controls
61 lines (54 loc) · 1.66 KB
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
name: Docker
on:
push:
tags:
- "*"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- name: Create RELEASE.txt
run: |
echo "GIT_COMMIT=${{ github.sha }}" > RELEASE.txt
echo "VERSION=${{ github.ref_name }}" >> RELEASE.txt
cat RELEASE.txt
- name: Login to GitHub registry
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- name: Build and push Docker container to GitHub registry
uses: docker/build-push-action@v5
with:
context: .
push: true
labels: |
git_commit=${{ github.sha }}
version=${{ github.ref_name }}
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
- name: Login to Docker Hub
uses: docker/login-action@v3
if: github.repository_owner == 'gridscale'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to Docker Hub
uses: docker/build-push-action@v5
if: github.repository_owner == 'gridscale'
with:
context: .
push: true
labels: |
git_commit=${{ github.sha }}
version=${{ github.ref_name }}
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${{ github.ref_name }}