Skip to content

Commit dd8904f

Browse files
authored
Merge pull request #49 from jodevsa/add-pr-pipeline
feat: create a pipeline on PR
2 parents c77c0ee + b322990 commit dd8904f

File tree

5 files changed

+101
-165
lines changed

5 files changed

+101
-165
lines changed

.github/workflows/build-images-workflow.yaml renamed to .github/workflows/build-images.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,25 @@ on:
99
ref:
1010
required: true
1111
type: string
12-
new_images_tag:
13-
required: true
12+
repository:
13+
description: 'Repository name with owner.'
14+
required: false
15+
default: ${{ github.repository }}
16+
type: string
17+
tag:
18+
required: false
19+
default: dev-${{ github.sha }}
1420
type: string
1521
push:
1622
required: true
1723
type: boolean
18-
set_new_images_as_latest:
19-
required: true
24+
latest:
25+
required: false
26+
default: false
2027
type: boolean
2128
platforms:
2229
description: 'Docker image platforms'
23-
required: true
30+
required: false
2431
default: 'linux/amd64, linux/arm64'
2532
type: string
2633

@@ -67,8 +74,8 @@ jobs:
6774
uses: docker/metadata-action@v4
6875
with:
6976
tags: |
70-
type=raw,value=latest, enable=${{ inputs.set_new_images_as_latest}}
71-
type=raw,value=${{ inputs.new_images_tag }}
77+
type=raw,value=latest, enable=${{ inputs.latest}}
78+
type=raw,value=${{ inputs.tag }}
7279
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.image }}
7380

7481
- uses: actions/setup-go@v3

.github/workflows/release.yaml renamed to .github/workflows/main-branch-push-workflow.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ jobs:
2727

2828
build-images:
2929
needs: [generate-next-semantic-version]
30-
uses: ./.github/workflows/build-images-workflow.yaml
30+
uses: ./.github/workflows/build-images.yaml
3131
with:
32-
set_new_images_as_latest: true
32+
latest: true
3333
push: true
34-
new_images_tag: ${{needs.generate-next-semantic-version.outputs.version}}
34+
tag: ${{needs.generate-next-semantic-version.outputs.version}}
3535
ref: ${{ github.sha }}
36-
platforms: "linux/amd64, linux/arm64"
3736

3837
release:
3938
needs: [build-images]
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Manual DEV Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
repository:
6+
description: 'Repository name with owner.'
7+
required: true
8+
default: 'jodevsa/wireguard-operator'
9+
type: string
10+
branch:
11+
description: 'The branch, tag or SHA to checkout.'
12+
required: true
13+
default: 'main'
14+
type: string
15+
platforms:
16+
description: 'Docker image platforms'
17+
required: true
18+
default: 'linux/amd64, linux/arm64'
19+
type: string
20+
tag:
21+
description: 'Docker image tag'
22+
required: true
23+
default: 'feature-1'
24+
type: string
25+
26+
env:
27+
REGISTRY: ghcr.io
28+
IMAGE_NAME: ${{ github.repository }}
29+
30+
permissions:
31+
contents: read
32+
packages: write
33+
34+
jobs:
35+
build-images:
36+
uses: ./.github/workflows/build-images.yaml
37+
with:
38+
push: true
39+
latest: false
40+
ref: ${{ inputs.branch }}
41+
repository: ${{ inputs.repository }}
42+
tag: dev-${{ inputs.tag }}
43+
44+
save-release:
45+
needs: [build-images]
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Set up Go
49+
uses: actions/setup-go@v3
50+
with:
51+
go-version: 1.20
52+
53+
- name: Checkout repository
54+
uses: actions/checkout@v3
55+
with:
56+
repository: ${{ inputs.repository }}
57+
ref: ${{ inputs.branch }}
58+
submodules: true
59+
60+
- name: prepare new release
61+
env:
62+
MANAGER_IMAGE: ghcr.io/${{ inputs.repository }}/manager:${{ inputs.tag }}
63+
AGENT_IMAGE: ghcr.io/${{ inputs.repository }}/agent:${{ inputs.tag }}
64+
run : |
65+
make generate-release-file AGENT_IMAGE="$AGENT_IMAGE" MANAGER_IMAGE="$MANAGER_IMAGE"
66+
- name: upload release
67+
uses: actions/upload-artifact@v3
68+
with:
69+
name: release.yaml
70+
path: ${{ github.workspace }}/release.yaml

.github/workflows/manual-release-dev.yaml

Lines changed: 0 additions & 154 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: build docker images
2+
on:
3+
pull_request: {}
4+
5+
permissions:
6+
contents: read
7+
packages: write
8+
9+
jobs:
10+
build-images:
11+
uses: ./.github/workflows/build-images.yaml
12+
with:
13+
push: false
14+
ref: ${{ github.ref }}

0 commit comments

Comments
 (0)