-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (75 loc) · 2.83 KB
/
docker.yml
File metadata and controls
87 lines (75 loc) · 2.83 KB
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
name: CI / Deploy to DockerHub
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
env:
REGISTRY: docker.io
IMAGE_NAME: ${{ secrets.DOCKER_USER }}/${{ secrets.DOCKER_IMAGE }}
USERNAME: ${{ secrets.DOCKER_USER }}
PASSWORD: ${{ secrets.DOCKER_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
name: Build the Docker Image
steps:
- uses: actions/checkout@v6
- name: Build the Docker Image
run: docker build . --file Dockerfile -t develop-actions:dev
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
name: Publish
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Install Cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 #v4.1.2
with:
cosign-release: 'v2.1.1'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Log into Registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@9f4a8ea54ed9055d5f86c993e1f2ffa674f98344 # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ env.PASSWORD }}
- name: Extract Docker Metadata
id: meta
uses: docker/metadata-action@85e876bd3a78bcc6b9925c818c482e365cf13b71 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
latest
edge
labels: |
org.opencontainers.image.title=develop-actions
org.opencontainers.image.vendor=Vedansh
org.opencontainers.image.source=https://github.com/offensive-vk/develop-actions/
- name: Build and Push Docker Image
id: build-and-push
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64,linux/arm/v7
- name: Upload Labels and Tags
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "## Summary - Docker CI " >> $GITHUB_STEP_SUMMARY
echo "Tags: ${{ steps.meta.outputs.tags }} " >> $GITHUB_STEP_SUMMARY
echo "Labels: ${{ steps.meta.outputs.labels }} " >> $GITHUB_STEP_SUMMARY
echo "Digest: ${{ steps.build-and-push.outputs.digest }} " >> $GITHUB_STEP_SUMMARY
echo "*** VERIFICATION COMPLETED ***"