This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
133 lines (120 loc) · 4.57 KB
/
docker-latest.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: "Latest image"
on:
workflow_dispatch:
schedule:
- cron: '42 5 15 * *' # At 05:42 on day-of-month 15.
jobs:
docker:
name: Build Docker images
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Set up Docker Buildx 🔧
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers 💾
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container registry 🏭
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push CLI image 🧪
id: docker_build
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: ghcr.io/cyclenerd/scp-tools-gitlab:test
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
docker-test:
name: Test Docker image
needs: [docker]
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Login to GitHub Container registry 🏭
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull CLI test image 💿
run: |
docker pull ghcr.io/cyclenerd/scp-tools-gitlab:test
docker tag ghcr.io/cyclenerd/scp-tools-gitlab:test scp-tools-gitlab
# Run tests
- name: Test Java versions 📏
run: docker run scp-tools-gitlab java --version
- name: Test Cloud Foundry CLI versions 📏
run: docker run scp-tools-gitlab cf --version
- name: Test Neo Environment SDK versions 📏
run: docker run scp-tools-gitlab neo.sh version
- name: Test Cloud MTA Build Tool versions 📏
run: docker run scp-tools-gitlab mbt --version
- name: Test MkDocs versions 📏
run: docker run scp-tools-gitlab mkdocs --version
github-registry-latest:
name: Push image to GitHub
runs-on: ubuntu-latest
needs: [docker-test]
steps:
- name: Login to GitHub Container registry 🏭
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull latest test image from GitHub container registry 📦
run: docker pull ghcr.io/cyclenerd/scp-tools-gitlab:test
- name: Quick test 📏
run: docker run ghcr.io/cyclenerd/scp-tools-gitlab:test java --version
- name: Push image to GitHub container registry as latest version 🚢
run: |
docker tag ghcr.io/cyclenerd/scp-tools-gitlab:test ghcr.io/cyclenerd/scp-tools-gitlab:latest
docker push ghcr.io/cyclenerd/scp-tools-gitlab:latest
docker-hub-latest:
name: Push image to Docker Hub
runs-on: ubuntu-latest
needs: [docker-test]
steps:
- name: Login to Docker Hub registry 🏭
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: Pull latest test image from GitHub container registry 📦
run: docker pull ghcr.io/cyclenerd/scp-tools-gitlab:test
- name: Quick test 📏
run: docker run ghcr.io/cyclenerd/scp-tools-gitlab:test java --version
- name: Push image to Docker Hub registry as latest version 🚢
run: |
docker tag ghcr.io/cyclenerd/scp-tools-gitlab:test cyclenerd/scp-tools-gitlab:latest
docker push cyclenerd/scp-tools-gitlab:latest
# Deletes old container images
# https://github.com/GoogleCloudPlatform/gcr-cleaner
gcr-cleaner:
runs-on: 'ubuntu-latest'
needs: [github-registry-latest,docker-hub-latest]
steps:
- name: Login to GitHub Container registry 🏭
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# customize based on the gcr-cleaner flags
- uses: 'docker://us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli'
with:
args: >-
-repo=ghcr.io/cyclenerd/scp-tools-gitlab
-grace=48h