-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (33 loc) · 1.12 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: Docker image
on:
push:
workflow_dispatch:
repository_dispatch:
jobs:
docker-image:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v3
- run: docker build -f Dockerfile -t subdirectory/subshell:${{ github.sha }} .
name: docker build
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- run: docker push subdirectory/subshell:${{ github.sha }}
name: docker push dockerhub sha
- run: |
docker tag subdirectory/subshell:${{ github.sha }} subdirectory/subshell
docker push subdirectory/subshell
if: github.ref == 'refs/heads/main'
name: docker push dockerhub latest
# get git tag
# https://github.com/orgs/community/discussions/26686
- run: |
docker tag subdirectory/subshell:${{ github.sha }} subdirectory/subshell:${{ github.ref_name }}
docker push subdirectory/subshell:${{ github.ref_name }}
name: docker push dockerhub tag