-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Docker Image CI | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
tags: ['v*'] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build the Docker image | ||
run: docker build -t squid-exporter . | ||
|
||
- name: Tag the Docker image latest | ||
run: docker tag squid-exporter ${{ secrets.DOCKER_USERNAME }}/squid-exporter:latest | ||
|
||
- name: Push the Docker image latest | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/squid-exporter:latest | ||
|
||
- name: Tag the Docker image version | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
run: docker tag squid-exporter ${{ secrets.DOCKER_USERNAME }}/squid-exporter:${{ github.ref_name }} | ||
|
||
- name: Push the Docker image latest | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/squid-exporter:${{ github.ref_name }} |