Skip to content

Commit

Permalink
migrate from drone ci to gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrokethecloud committed Apr 22, 2024
1 parent d154dc3 commit 84e640c
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 62 deletions.
61 changes: 0 additions & 61 deletions .drone.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Master Build and Publish

on:
push:
branches:
- master
- release/v*

jobs:
build-master:
uses: ./.github/workflows/template-build.yml
with:
release-tag-name: ${{ github.ref_name }}-head
push: true
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Pull Request Build

on:
pull_request:

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

on:
push:
tags:
- v*

jobs:
build-tag:
uses: ./.github/workflows/template-build.yml
with:
release-tag-name: ${{ github.ref_name }}
push: true
secrets: inherit
57 changes: 57 additions & 0 deletions .github/workflows/template-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on:
workflow_call:
inputs:
release-tag-name:
required: true
type: string
push:
required: true
type: boolean
env:
imageName: "rancher/harvester-pcidevices"

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
uses: docker/build-push-action@v5
with:
provenance: false
context: .
platforms: linux/amd64,linux/arm64
file: package/Dockerfile
push: ${{ inputs.push }}
tags: ${{env.imageName}}:${{ inputs.release-tag-name }}
build-args: |
VERSION=${{ github.ref_name }}-${{ github.sha }}-head
2 changes: 1 addition & 1 deletion scripts/validate
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ if [[ -z "$(command -v golangci-lint)" ]]; then
fi

echo "Running: golangci-lint run"
golangci-lint run
golangci-lint run --timeout 10m

0 comments on commit 84e640c

Please sign in to comment.