Skip to content
Merged

Dev #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/Dev-Container-Publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Dev Container Publish

on:
workflow_dispatch:

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
short_sha: ${{ steps.vars.outputs.short_sha }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get short SHA
id: vars
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT

docker-publish-dashboard:
needs: prepare
uses: ./.github/workflows/reusable-docker-publish.yml
permissions:
contents: write
packages: write
attestations: write
id-token: write
with:
image_name: ${{ github.repository }}/dashboard
dockerfile: ./Containerfile.dashboard
tags: |
ghcr.io/${{ github.repository }}/dashboard:dev
ghcr.io/${{ github.repository }}/dashboard:dev-${{ needs.prepare.outputs.short_sha }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

docker-publish-python:
needs: prepare
uses: ./.github/workflows/reusable-docker-publish.yml
permissions:
contents: write
packages: write
attestations: write
id-token: write
with:
image_name: ${{ github.repository }}/python
dockerfile: ./Containerfile.python
tags: |
ghcr.io/${{ github.repository }}/python:dev
ghcr.io/${{ github.repository }}/python:dev-${{ needs.prepare.outputs.short_sha }}
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/Sync-dev-with-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Rebase main and dev and add .dev to version

on:
workflow_run:
workflows: ["Tag and Release"]
types:
- completed
workflow_dispatch:

jobs:
rebase:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
token: ${{ secrets.BOT_ACCESS_TOKEN }}

- name: Setup Git
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"

- name: Fetch all branches
run: git fetch --all

- name: Rebase dev with main
run: |
git checkout dev
git rebase origin/main

- name: Update the version to <latest>.dev
id: update_version
run: |
version_number=$(cat VERSION)
if [[ "$version_number" != *.dev ]]; then
echo "${version_number}.dev" > VERSION
fi

- name: Commit changes
run: |
git add VERSION
git commit -m "Dev Version update"
git push --force-with-lease
101 changes: 101 additions & 0 deletions .github/workflows/Tag-and-Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Tag and Release

on:
pull_request:
types: [closed]
branches: ['main']

jobs:
release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_tag.outputs.version }}
permissions:
contents: write
packages: write
attestations: write
id-token: write
if: startsWith(github.event.pull_request.title, 'Release:') && github.event.pull_request.merged == true
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

- name: Get tag
id: get_tag
run: |
git pull
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT

- name: Tag the commit
run: |
next_version=${{ steps.get_tag.outputs.version }}
git tag -a "$next_version" -m "Version $next_version"
git push --follow-tags

docker-publish-dashboard:
needs: release
uses: ./.github/workflows/reusable-docker-publish.yml
permissions:
contents: write
packages: write
attestations: write
id-token: write
with:
image_name: ${{ github.repository }}/dashboard
dockerfile: ./Containerfile.dashboard
tags: |
ghcr.io/${{ github.repository }}/dashboard:${{ needs.release.outputs.version }}
ghcr.io/${{ github.repository }}/dashboard:latest
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

docker-publish-python:
needs: release
uses: ./.github/workflows/reusable-docker-publish.yml
permissions:
contents: write
packages: write
attestations: write
id-token: write
with:
image_name: ${{ github.repository }}/python
dockerfile: ./Containerfile.python
tags: |
ghcr.io/${{ github.repository }}/python:${{ needs.release.outputs.version }}
ghcr.io/${{ github.repository }}/python:latest
secrets:
token: ${{ secrets.GITHUB_TOKEN }}

create-release:
needs: [release, docker-publish-dashboard, docker-publish-python]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create changelog diff
run: |
sed -n '/#### \[${{ needs.release.outputs.version }}\]/,/^#### /p' CHANGELOG.md | sed '$d' > release_notes.md

- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.release.outputs.version }}
name: Release ${{ needs.release.outputs.version }}
body_path: ./release_notes.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Delete release_notes file
run: rm release_notes.md
58 changes: 58 additions & 0 deletions .github/workflows/Update-Version-and-create-Releases-PR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Update version and create Release's PR

on:
workflow_dispatch:
inputs:
version:
description: 'Version name'
required: true
type: string
pattern: '^[0-9]+\.[0-9]+\.[0-9]+$'

jobs:
version:
runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write
packages: write
attestations: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Setup Git
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: Update the version
id: update_version
run: |
echo '${{ inputs.version }}' > VERSION
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
- name: Update Changelog
run: |
npm install -g auto-changelog
auto-changelog -v ${{ steps.update_version.outputs.version }}
- name: Create pull request
id: create_pr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: release/${{ steps.update_version.outputs.version }}
title: "Release: Candidate Version ${{ steps.update_version.outputs.version }} Pull Request"
body: "This pull request contains the updated VERSION file with the new release version and an updated CHANGELOG.md file."
base: main
assignees: paulstretenowich
reviewers: paulstretenowich
delete-branch: true
labels: automated pr
66 changes: 66 additions & 0 deletions .github/workflows/reusable-docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Docker Publish

on:
workflow_call:
inputs:
image_name:
required: true
type: string
tags:
required: true
type: string
platforms:
required: false
type: string
default: linux/amd64,linux/arm64
dockerfile:
required: false
type: string
default: ./Containerfile
context:
required: false
type: string
default: .
secrets:
token:
required: true

jobs:
docker-publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
attestations: write
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Update package lists
run: sudo apt-get update

- name: Install QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.token }}

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ${{ inputs.context }}
file: ${{ inputs.dockerfile }}
push: true
sbom: true
provenance: true
tags: ${{ inputs.tags }}
platforms: ${{ inputs.platforms }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.0.1