-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (42 loc) · 1.39 KB
/
pipeline.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
44
45
name: Pipeline
on:
push:
branches:
- 'main'
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:
jobs:
publish-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: |
VERSION=$(cat VERSION | tr -d ' \t\n\r')
docker build . -t ${{ vars.DOCKER_HUB_USERNAME }}/backup:latest -t ${{ vars.DOCKER_HUB_USERNAME }}/backup:${VERSION}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Push to Docker Hub
run: |
docker push ${{ vars.DOCKER_HUB_USERNAME }}/backup:latest
docker push ${{ vars.DOCKER_HUB_USERNAME }}/backup:${VERSION}
env:
username: ${{ vars.DOCKER_HUB_USERNAME }}
publish-dockerhub-description:
if: contains('refs/heads/master', github.ref)
needs:
- publish-docker-image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update Dockerhub description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ vars.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
repository: ${{ vars.DOCKER_HUB_USERNAME }}/backup
readme-filepath: ./README.md