Skip to content

Commit

Permalink
feat: add build step
Browse files Browse the repository at this point in the history
  • Loading branch information
mdshack committed Mar 13, 2024
1 parent 4400bb5 commit 53f6ef5
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: ci

on:
push:
branches:
- 'main'

jobs:
release:
name: Release
runs-on: ubuntu-latest
outputs:
pr: ${{ steps.release.outputs.pr }}
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
patch: ${{ steps.release.outputs.patch }}
steps:
- name: Release Please
id: release
uses: google-github-actions/release-please-action@v3
with:
release-type: rust
token: ${{ secrets.GH_PAT }}

build_and_release_docker_image:
name: Build & Release Docker Image
runs-on: ubuntu-latest
needs: release
if: ${{ needs.release.outputs.release_created }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.release.outputs.tag_name }}

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

- name: Login to Docker
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: true
platform: |
linux/amd64
target: precompiled-pinn-image
tags: |
${{ secrets.DOCKER_REPOSITORY }}:latest
${{ secrets.DOCKER_REPOSITORY }}:${{ needs.release.outputs.major }}
${{ secrets.DOCKER_REPOSITORY }}:${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }}
${{ secrets.DOCKER_REPOSITORY }}:${{ needs.release.outputs.major }}.${{ needs.release.outputs.minor }}.${{ needs.release.outputs.patch }}
cache-from: "type=registry,ref=${{ secrets.DOCKER_REPOSITORY }}:cache"
cache-to: "type=registry,ref=${{ secrets.DOCKER_REPOSITORY }}:cache,mode=max"

0 comments on commit 53f6ef5

Please sign in to comment.