-
Notifications
You must be signed in to change notification settings - Fork 8
85 lines (75 loc) · 2.97 KB
/
ghcr-io-docker-build.yaml
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
name: GitHub CR Build and Push
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ master ]
schedule:
- cron: '0 0 1 * *'
env:
REGISTRY: ghcr.io
# IMAGE_NAME: ${{ github.repository }}
# github.repository as <account>/<repo>
jobs:
buildPush:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@0f069ddc17b8eb78586b08a7fe335fd54649e2d3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@7ca345011ac4304463197fac0e56eab1bc7e6af0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Jenkins Docker metadata
id: meta
uses: docker/metadata-action@b53be03109c4ef6f6cc7aa545b84b17a7fe51c1e
with:
images: ${{ env.REGISTRY }}/${{ github.actor }}/jenkinsdsl
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and Push Jenkins image
id: build-and-push
uses: docker/build-push-action@0259cb088b9283926c6ffe4374b2a06a25c8c131
with:
context: .
file: docker/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Action to get the digest...
- name: GitOps Helm Chart Update(s)
uses: tpayne/github-actions/productmanifest@main
env:
API_TOKEN_GITHUB: ${{ secrets.XGITHUB_PAT }}
with:
gitops-repo-url: https://github.com/tpayne/codefresh-csdp-samples
manifest-file: helm/dev/values.yaml
github-username: ${{ secrets.XGITHUB_USER }}
github-email: ${{ secrets.XGITHUB_EMAIL }}
image-list: jenkinscd-framework-deployment:${{ env.REGISTRY }}/${{ github.actor }}/jenkinsdsl:master
git-token: ${{ secrets.XGITHUB_PAT }}
registry-server: ${{ env.REGISTRY }}
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.XGITHUB_PAT }}