Skip to content

Commit

Permalink
ci: add semver release and Docker build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanaturner committed Mar 4, 2023
1 parent 8b4c44f commit a234fe0
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/release-and-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release SemVer and Build Docker Image

on:
push:
branches:
- main

jobs:
release:
name: Release new semantic version
runs-on: ubuntu-latest
outputs:
didRelease: ${{ steps.semver.outputs.new_release_published }}
newVersion: ${{ steps.semver.outputs.new_release_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: semantic-release
uses: cycjimmy/semantic-release-action@v3
id: semver
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
name: Build Docker image
needs: release
if: needs.release.outputs.didRelease == 'true'
runs-on: ubuntu-latest
steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: format('{0}:{1}', github.repository, needs.release.outputs.newVersion)

0 comments on commit a234fe0

Please sign in to comment.