-
-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (37 loc) · 1.48 KB
/
BuildImage.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
name: Build Image
on: [push, pull_request, workflow_dispatch]
env:
ENDPOINT: "aptalca/rclone"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.1.0
- name: Build image
run: |
docker build --no-cache -t ${{ github.sha }} .
- name: Tag image
if: ${{ github.ref == format('refs/heads/master') }}
run: |
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${{ github.sha }}
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:latest
docker tag ${{ github.sha }} ${ENDPOINT}:${{ github.sha }}
docker tag ${{ github.sha }} ${ENDPOINT}:latest
- name: Login to GitHub Container Registry
if: ${{ github.ref == format('refs/heads/master') }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u aptalca --password-stdin
- name: Push tags to GitHub Container Registry
if: ${{ github.ref == format('refs/heads/master') }}
run: |
docker push ghcr.io/${ENDPOINT}:${{ github.sha }}
docker push ghcr.io/${ENDPOINT}:latest
- name: Login to DockerHub
if: ${{ github.ref == format('refs/heads/master') }}
run: |
echo ${{ secrets.DOCKERPASS }} | docker login -u aptalca --password-stdin
- name: Push tags to DockerHub
if: ${{ github.ref == format('refs/heads/master') }}
run: |
docker push ${ENDPOINT}:${{ github.sha }}
docker push ${ENDPOINT}:latest