forked from CyberCX-STA/PurpleOps
-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (36 loc) · 1.17 KB
/
dev_build_push.yml
File metadata and controls
44 lines (36 loc) · 1.17 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
name: Build and push dev image
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
# Only allow running on the dev branch
if: github.ref == 'refs/heads/dev'
permissions:
contents: write # Needed to create tags and releases
packages: write # Needed to push to GHCR
id-token: write # For trusted publishing
steps:
- name: Checkout dev branch
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create lowercase repository name
id: repo
run: echo "name=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Build and push :dev image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/${{ steps.repo.outputs.name }}:dev
cache-from: type=gha
cache-to: type=gha,mode=max