Skip to content

Commit ef2e3e5

Browse files
Merge pull request #18 from c3g/dev
Dev
2 parents 400431c + cf31636 commit ef2e3e5

File tree

7 files changed

+329
-0
lines changed

7 files changed

+329
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Dev Container Publish
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
prepare:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
short_sha: ${{ steps.vars.outputs.short_sha }}
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Get short SHA
16+
id: vars
17+
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
18+
19+
docker-publish-dashboard:
20+
needs: prepare
21+
uses: ./.github/workflows/reusable-docker-publish.yml
22+
permissions:
23+
contents: write
24+
packages: write
25+
attestations: write
26+
id-token: write
27+
with:
28+
image_name: ${{ github.repository }}/dashboard
29+
dockerfile: ./Containerfile.dashboard
30+
tags: |
31+
ghcr.io/${{ github.repository }}/dashboard:dev
32+
ghcr.io/${{ github.repository }}/dashboard:dev-${{ needs.prepare.outputs.short_sha }}
33+
secrets:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
36+
docker-publish-python:
37+
needs: prepare
38+
uses: ./.github/workflows/reusable-docker-publish.yml
39+
permissions:
40+
contents: write
41+
packages: write
42+
attestations: write
43+
id-token: write
44+
with:
45+
image_name: ${{ github.repository }}/python
46+
dockerfile: ./Containerfile.python
47+
tags: |
48+
ghcr.io/${{ github.repository }}/python:dev
49+
ghcr.io/${{ github.repository }}/python:dev-${{ needs.prepare.outputs.short_sha }}
50+
secrets:
51+
token: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Rebase main and dev and add .dev to version
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Tag and Release"]
6+
types:
7+
- completed
8+
workflow_dispatch:
9+
10+
jobs:
11+
rebase:
12+
runs-on: ubuntu-latest
13+
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
ref: ${{ github.head_ref }}
19+
fetch-depth: 0
20+
token: ${{ secrets.BOT_ACCESS_TOKEN }}
21+
22+
- name: Setup Git
23+
run: |
24+
git config user.email "github-actions[bot]@users.noreply.github.com"
25+
git config user.name "github-actions[bot]"
26+
27+
- name: Fetch all branches
28+
run: git fetch --all
29+
30+
- name: Rebase dev with main
31+
run: |
32+
git checkout dev
33+
git rebase origin/main
34+
35+
- name: Update the version to <latest>.dev
36+
id: update_version
37+
run: |
38+
version_number=$(cat VERSION)
39+
if [[ "$version_number" != *.dev ]]; then
40+
echo "${version_number}.dev" > VERSION
41+
fi
42+
43+
- name: Commit changes
44+
run: |
45+
git add VERSION
46+
git commit -m "Dev Version update"
47+
git push --force-with-lease
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Tag and Release
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: ['main']
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
version: ${{ steps.get_tag.outputs.version }}
13+
permissions:
14+
contents: write
15+
packages: write
16+
attestations: write
17+
id-token: write
18+
if: startsWith(github.event.pull_request.title, 'Release:') && github.event.pull_request.merged == true
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Setup Git
26+
run: |
27+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
28+
git config --local user.name "github-actions[bot]"
29+
30+
- name: Get tag
31+
id: get_tag
32+
run: |
33+
git pull
34+
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
35+
36+
- name: Tag the commit
37+
run: |
38+
next_version=${{ steps.get_tag.outputs.version }}
39+
git tag -a "$next_version" -m "Version $next_version"
40+
git push --follow-tags
41+
42+
docker-publish-dashboard:
43+
needs: release
44+
uses: ./.github/workflows/reusable-docker-publish.yml
45+
permissions:
46+
contents: write
47+
packages: write
48+
attestations: write
49+
id-token: write
50+
with:
51+
image_name: ${{ github.repository }}/dashboard
52+
dockerfile: ./Containerfile.dashboard
53+
tags: |
54+
ghcr.io/${{ github.repository }}/dashboard:${{ needs.release.outputs.version }}
55+
ghcr.io/${{ github.repository }}/dashboard:latest
56+
secrets:
57+
token: ${{ secrets.GITHUB_TOKEN }}
58+
59+
docker-publish-python:
60+
needs: release
61+
uses: ./.github/workflows/reusable-docker-publish.yml
62+
permissions:
63+
contents: write
64+
packages: write
65+
attestations: write
66+
id-token: write
67+
with:
68+
image_name: ${{ github.repository }}/python
69+
dockerfile: ./Containerfile.python
70+
tags: |
71+
ghcr.io/${{ github.repository }}/python:${{ needs.release.outputs.version }}
72+
ghcr.io/${{ github.repository }}/python:latest
73+
secrets:
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
76+
create-release:
77+
needs: [release, docker-publish-dashboard, docker-publish-python]
78+
runs-on: ubuntu-latest
79+
permissions:
80+
contents: write
81+
steps:
82+
- name: Checkout code
83+
uses: actions/checkout@v4
84+
85+
- name: Create changelog diff
86+
run: |
87+
sed -n '/#### \[${{ needs.release.outputs.version }}\]/,/^#### /p' CHANGELOG.md | sed '$d' > release_notes.md
88+
89+
- name: Create release
90+
uses: softprops/action-gh-release@v2
91+
with:
92+
tag_name: ${{ needs.release.outputs.version }}
93+
name: Release ${{ needs.release.outputs.version }}
94+
body_path: ./release_notes.md
95+
draft: false
96+
prerelease: false
97+
env:
98+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
100+
- name: Delete release_notes file
101+
run: rm release_notes.md
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Update version and create Release's PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version name'
8+
required: true
9+
type: string
10+
pattern: '^[0-9]+\.[0-9]+\.[0-9]+$'
11+
12+
jobs:
13+
version:
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
packages: write
20+
attestations: write
21+
id-token: write
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
ref: main
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: 18
33+
- name: Setup Git
34+
run: |
35+
git config user.email "github-actions[bot]@users.noreply.github.com"
36+
git config user.name "github-actions[bot]"
37+
- name: Update the version
38+
id: update_version
39+
run: |
40+
echo '${{ inputs.version }}' > VERSION
41+
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
42+
- name: Update Changelog
43+
run: |
44+
npm install -g auto-changelog
45+
auto-changelog -v ${{ steps.update_version.outputs.version }}
46+
- name: Create pull request
47+
id: create_pr
48+
uses: peter-evans/create-pull-request@v7
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
branch: release/${{ steps.update_version.outputs.version }}
52+
title: "Release: Candidate Version ${{ steps.update_version.outputs.version }} Pull Request"
53+
body: "This pull request contains the updated VERSION file with the new release version and an updated CHANGELOG.md file."
54+
base: main
55+
assignees: paulstretenowich
56+
reviewers: paulstretenowich
57+
delete-branch: true
58+
labels: automated pr
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Docker Publish
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
image_name:
7+
required: true
8+
type: string
9+
tags:
10+
required: true
11+
type: string
12+
platforms:
13+
required: false
14+
type: string
15+
default: linux/amd64,linux/arm64
16+
dockerfile:
17+
required: false
18+
type: string
19+
default: ./Containerfile
20+
context:
21+
required: false
22+
type: string
23+
default: .
24+
secrets:
25+
token:
26+
required: true
27+
28+
jobs:
29+
docker-publish:
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write
33+
packages: write
34+
attestations: write
35+
id-token: write
36+
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Update package lists
42+
run: sudo apt-get update
43+
44+
- name: Install QEMU
45+
uses: docker/setup-qemu-action@v3
46+
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Login to GitHub Container Registry
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ghcr.io
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.token }}
56+
57+
- name: Build and push Docker image
58+
uses: docker/build-push-action@v6
59+
with:
60+
context: ${{ inputs.context }}
61+
file: ${{ inputs.dockerfile }}
62+
push: true
63+
sbom: true
64+
provenance: true
65+
tags: ${{ inputs.tags }}
66+
platforms: ${{ inputs.platforms }}

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Changelog
2+
3+
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
4+
5+
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.1

0 commit comments

Comments
 (0)