feat: badges and CI #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: StreamSculpt image build and release automation workflow | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-publisher: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Set the list of tags for the Docker image | |
tags: | | |
type=ref,event=tag | |
type=raw,value=latest | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./docker/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
create-release: | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
needs: build-and-push-publisher | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create package.json with latest tag | |
run: | | |
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo "Latest tag is $latest_tag" | |
echo "{\"version\": \"${latest_tag#v}\"}" > package.json | |
echo "LATEST_TAG=${latest_tag}" >> $GITHUB_ENV | |
- name: Conventional Changelog Action | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@v4 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
output-file: 'false' | |
skip-tag: true | |
skip-git-pull: "true" | |
skip-on-empty: "false" | |
git-push: "false" | |
skip-version-file: "true" | |
- name: Create Release | |
uses: actions/create-release@v1 | |
if: steps.changelog.outputs.skipped != 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.LATEST_TAG }} | |
release_name: ${{ env.LATEST_TAG }} | |
body: ${{ steps.changelog.outputs.clean_changelog }} | |
draft: false | |
prerelease: false |