Skip to content

Commit

Permalink
Fix builds for non main branches
Browse files Browse the repository at this point in the history
Signed-off-by: asararatnakar <asara.ratnakar@gmail.com>
  • Loading branch information
asararatnakar committed Sep 25, 2023
1 parent 19a5c72 commit 0f4686c
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/endtoend-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ name: Sample Network E2E Test

on:
push:
branches: [main]
branches: [v1.*]
pull_request:
branches: [main]
branches: [v1.*]

jobs:
suite:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/image-build-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build Operator image

on:
pull_request:
branches: [main]
branches: [v1.*]

jobs:
image:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/image-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Build Operator image

on:
push:
branches: [main]
branches: [v1.*]

jobs:
image:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ name: Integration Test

on:
push:
branches: [main]
branches: [v1.*]
pull_request:
branches: [main]
branches: [v1.*]

env:
KUBECONFIG_PATH: /tmp/kubeconfig.yaml
OPERATOR_NAMESPACE: inttest
DOCKERCONFIGJSON: ${{ secrets.DOCKERCONFIGJSON }}
GO_VER: 1.18
GO_VER: 1.20

jobs:
suite:
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Release Operator

on:
pull_request:
branches: [v1.*]
push:
tags: [v1.*]

env:
GO_VER: 1.20.6
GO_TAGS: ""
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
SEMREV_LABEL: ${{ github.ref_name }}

permissions:
contents: read

jobs:
build-and-push-image:
runs-on: ubuntu-20.04

permissions:
contents: read
packages: write

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
config-inline: |
[worker.oci]
max-parallelism = 1
- name: Checkout
uses: actions/checkout@v3

- name: Login to the GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
- name: Build and push
id: push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GO_VER=${{ env.GO_VER }}
GO_TAGS=${{ env.GO_TAGS }}
BUILD_ID=${{ env.SEMREV_LABEL }}
BUILD_DATE=${{ env.BUILD_DATE }}
create-release:
name: Create GitHub Release
needs: [ build-and-push-image ]
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Release Operator Version
uses: ncipollo/release-action@v1
with:
allowUpdates: "true"
bodyFile: release_notes/${{ env.SEMREV_LABEL }}.md
tag: ${{ env.SEMREV_LABEL }}
token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 4 additions & 5 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@
name: unit-tests

on:
# TODO: uncomment this when moved to hyperledger-labs repo
# push:
# branches: [main]
push:
branches: [v1.*]
pull_request:
branches: [main]
branches: [v1.*]

env:
GO_VER: 1.18
GO_VER: 1.20

jobs:
make-checks:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
IMAGE ?= ghcr.io/hyperledger-labs/fabric-operator
TAG ?= $(shell git rev-parse --short HEAD)
ARCH ?= $(shell go env GOARCH)
OSS_GO_VER ?= 1.20.3
OSS_GO_VER ?= 1.20.6
BUILD_DATE = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
OS = $(shell go env GOOS)

Expand Down

0 comments on commit 0f4686c

Please sign in to comment.