-
Notifications
You must be signed in to change notification settings - Fork 45
112 lines (92 loc) · 3.86 KB
/
build-publish.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
name: build-publish-scan
on:
push:
branches:
permissions:
actions: read # for detecting the Github Actions environment.
id-token: write # for creating OIDC tokens for signing.
packages: write # for uploading attestations.
contents: read
jobs:
build-publish-python:
runs-on: ubuntu-latest
env:
DOCKER_REPO: 'docker-local'
IMAGE_NAME: 'github-jfrog-example:3'
JF_PROJECT: ${{ vars.JF_PROJECT }}
JF_URL: https://${{ vars.JF_URL }}/
steps:
# Setup Go
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.22.x
cache: false
# Build the specific CLI branch
- name: Checkout code
uses: actions/checkout@v4
with:
repository: "eyaldelarea/jfrog-cli"
ref: "job_summaries"
- name: Build current CLI
run: go build .
# Use the specific setup-cli branch
- uses: eyaldelarea/setup-jfrog-cli@cleanUpSummaries
name: Setup JFrog CLI
id: setup-cli
env:
JF_URL: https://${{ vars.JF_URL }}/
with:
oidc-provider-name: jfrog-github-oidc
- name: check filesystem 1
run: |
mv ./jfrog-cli /tmp/
- name: Checkout the repository
uses: actions/checkout@v4
- name: configure jfrog environment
run: |
/tmp/jfrog-cli pip-config --repo-resolve=python-virtual
- name: configure environment
run: |
python3 -m pip install --upgrade pip setuptools wheel sigstore
wheel -h
pip show setuptools
echo $VIRTUAL_ENV
- name: build project
run: |
/tmp/jfrog-cli pip install -r requirements.txt --module=jfrog-python-example
python setup.py sdist bdist_wheel
cd dist && echo "hashes=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
- name: publish python package
run: |
/tmp/jfrog-cli rt u dist/ python-virtual/example-projects/ --module=jfrog-python-example
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Authenticate Docker
uses: docker/login-action@v3
with:
registry: ${{ vars.JF_URL }}
username: ${{ steps.setup-cli.outputs.oidc-user }}
password: ${{ steps.setup-cli.outputs.oidc-token }}
- name: Build Docker image
uses: docker/build-push-action@v5
id: build
with:
push: true
platforms: linux/amd64 #, linux/arm64
tags: ${{ vars.JF_URL }}/${{ env.DOCKER_REPO }}/${{ env.IMAGE_NAME }}
- name: docker scan
run: |
/tmp/jfrog-cli docker pull ${{ vars.JF_URL }}/${{ env.DOCKER_REPO }}/${{ env.IMAGE_NAME }}
/tmp/jfrog-cli docker scan ${{ vars.JF_URL }}/${{ env.DOCKER_REPO }}/${{ env.IMAGE_NAME }}
- name: add docker package to build
run: |
echo "${{ vars.JF_URL }}/${{ env.DOCKER_REPO }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}" > metadata.json
/tmp/jfrog-cli rt build-docker-create ${{ env.DOCKER_REPO }} --image-file metadata.json
- name: publish build info
run: |
/tmp/jfrog-cli rt bce
/tmp/jfrog-cli rt bp
- name: build scan
run: |
/tmp/jfrog-cli build-scan --fail=false