File tree Expand file tree Collapse file tree 3 files changed +45
-23
lines changed
Expand file tree Collapse file tree 3 files changed +45
-23
lines changed Original file line number Diff line number Diff line change 1111 - ' .gitignore'
1212 - ' LICENSE'
1313
14- permissions :
15- contents : write
16- pull-requests : read
1714
1815env :
19- ghcr_repo_addr : ghcr.io/shayan-ghani/container-exporter:latest
20- docker_repo_addr : shayanghani/container-exporter:latest
21- docker_hub_user : shayanghani
16+ ghcr_repo_addr : ghcr.io/shayan-ghani/container-exporter:pr-${{github.run_id}}
2217
2318jobs :
2419
2823 - name : Checkout
2924 uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
3025
31- - name : Login to Docker Hub
32- uses : docker/login-action@v3
33- with :
34- username : ${{ env.docker_hub_user }}
35- password : ${{ secrets.DOCKER_TOKEN }}
36-
3726 - name : Login to GHCR
3827 uses : docker/login-action@v3
3928 with :
5241 with :
5342 context : .
5443 push : true
55- tags : |
56- ${{env.ghcr_repo_addr}}
57- ${{env.docker_repo_addr}}
44+ tags : ${{env.ghcr_repo_addr}}
5845
5946
6047
Original file line number Diff line number Diff line change 1- name : CI for development branches
1+ name : CI- development
22
33on :
44 push :
2626 - ' .gitignore'
2727 - ' LICENSE'
2828
29- permissions :
30- contents : write
31- pull-requests : read
3229
3330env :
34- ghcr_repo_addr : ghcr.io/shayan-ghani/container-exporter:latest
31+ ghcr_repo_addr : ghcr.io/shayan-ghani/container-exporter:${{github.action}}-${{github.run_id}}
3532
3633jobs :
37- probe :
34+ build-and-check :
3835 runs-on : ubuntu-latest
3936 steps :
4037 - name : Checkout
Original file line number Diff line number Diff line change 1414 branches :
1515 - master
1616
17+ permissions :
18+ contents : write
19+ pull-requests : read
20+
1721env :
1822 ghcr_repo_addr : ghcr.io/shayan-ghani/container-exporter:latest
19-
23+ docker_repo_addr : shayanghani/container-exporter
24+ docker_hub_user : shayanghani
25+
2026jobs :
2127 release :
28+ outputs :
29+ image_tag : ${{ steps.bump.outputs.new_tag }}
30+
2231 if : github.event_name != 'pull_request' && github.ref_name == 'master'
2332 runs-on : ubuntu-latest
2433 steps :
3544 uses : softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
3645 with :
3746 body : ${{ steps.bump.outputs.changelog }}
38- tag_name : ${{ steps.bump.outputs.new_tag }}
47+ tag_name : ${{ steps.bump.outputs.new_tag }}
48+
49+ docker-push :
50+ runs-on : ubuntu-latest
51+ needs : release
52+ steps :
53+ - name : Checkout
54+ uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
55+
56+ - name : Login to Docker Hub
57+ uses : docker/login-action@v3
58+ with :
59+ username : ${{ env.docker_hub_user }}
60+ password : ${{ secrets.DOCKER_TOKEN }}
61+
62+ - name : Set up QEMU
63+ uses : docker/setup-qemu-action@v3
64+
65+ - name : Set up Docker Buildx
66+ uses : docker/setup-buildx-action@v3
67+
68+ - name : Build and Push to Dockerhub
69+ uses : docker/build-push-action@v6
70+ with :
71+ context : .
72+ push : true
73+ tags : |
74+ "${{env.docker_repo_addr}}:${{ needs.release.outputs.image_tag }}"
75+ "${{env.docker_repo_addr}}:latest"
76+
You can’t perform that action at this time.
0 commit comments