Skip to content

Commit

Permalink
GHA: init github actions
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Cheng <[email protected]>
  • Loading branch information
Vicente-Cheng committed Aug 20, 2024
1 parent 5d71aa9 commit 7dcb2e5
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Dev Build and Publish

on:
push:
branches:
- master

jobs:
build-for-dev:
uses: ./.github/workflows/factory.yml
with:
tag: ${{ github.ref_name }}-head
push: true
secrets: inherit
57 changes: 57 additions & 0 deletions .github/workflows/factory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on:
workflow_call:
inputs:
tag:
required: true
type: string
push:
required: true
type: boolean

env:
repo: "rancher"
controllerImageName: "harvester-networkfs-manager"

jobs:
dapper-build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Run dapper
run: make ci

- name: Read some Secrets
uses: rancher-eio/read-vault-secrets@main
if: ${{ inputs.push == true }}
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/rancher/credentials password | DOCKER_PASSWORD
- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ inputs.push == true }}
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Docker Build (Controller)
uses: docker/build-push-action@v5
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: package/Dockerfile
push: ${{ inputs.push }}
tags: ${{ env.repo }}/${{ env.controllerImageName }}:${{ inputs.tag }}
13 changes: 13 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Pull Request Build

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
build-for-dev:
uses: ./.github/workflows/factory.yml
with:
tag: pr-${{ github.event.number }}
push: false
secrets: inherit
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Release Build and Publish

on:
push:
tags:
- v**

jobs:
build-for-release:
uses: ./.github/workflows/factory.yml
with:
tag: ${{ github.ref_name }}
push: true
secrets: inherit

0 comments on commit 7dcb2e5

Please sign in to comment.