Skip to content

Commit

Permalink
build and push images on main or tags if tests pass, use main for def…
Browse files Browse the repository at this point in the history
…ault image tag
  • Loading branch information
AshleyDumaine committed Apr 3, 2024
1 parent de59fb1 commit de3338e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and Push
on:
push:
branches:
- main
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest
needs: go-build-test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: linode/cluster-api-provider-linode
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
22 changes: 1 addition & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
jobs:
release:
runs-on: ubuntu-latest
needs: go-build-test
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -20,24 +21,3 @@ jobs:
with:
files: |
./release
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
linode/cluster-api-provider-linode
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=semver,pattern={{raw}},value=${{ github.ref_name }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and Push to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion config/default/manager_image_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ spec:
template:
spec:
containers:
- image: docker.io/linode/cluster-api-provider-linode:v0.1.0
- image: docker.io/linode/cluster-api-provider-linode:main
name: manager

0 comments on commit de3338e

Please sign in to comment.