Skip to content

Commit 577e5bf

Browse files
authored
Merge pull request #6 from SmartCityFlensburg/release/v0.0.1
Release version v0.0.1
2 parents 5109c58 + 867447e commit 577e5bf

18 files changed

+572
-1
lines changed

.docker/Dockerfile.dev

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:20-alpine as builder-web
2+
3+
WORKDIR /app/build
4+
COPY ./package.json ./package.json
5+
RUN yarn --frozen-lockfile
6+
7+
COPY . .
8+
RUN yarn build:dev
9+
10+
11+
FROM nginx:latest
12+
COPY --from=builder-web /app/build/dist /usr/share/nginx/html
13+
14+
EXPOSE 80
15+
16+
CMD ["nginx", "-g", "daemon off;"]

.docker/Dockerfile.prod

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:20-alpine as builder-web
2+
3+
WORKDIR /app/build
4+
COPY ./package.json ./package.json
5+
RUN yarn --frozen-lockfile
6+
7+
COPY . .
8+
RUN yarn build
9+
10+
11+
FROM nginx:latest
12+
COPY --from=builder-web /app/build/dist /usr/share/nginx/html
13+
14+
EXPOSE 80
15+
16+
CMD ["nginx", "-g", "daemon off;"]

.docker/Dockerfile.stage

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM node:20-alpine as builder-web
2+
3+
WORKDIR /app/build
4+
COPY ./package.json ./package.json
5+
RUN yarn --frozen-lockfile
6+
7+
COPY . .
8+
RUN yarn build:stage
9+
10+
11+
FROM nginx:latest
12+
COPY --from=builder-web /app/build/dist /usr/share/nginx/html
13+
14+
EXPOSE 80
15+
16+
CMD ["nginx", "-g", "daemon off;"]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and Push Docker Image Develop
2+
"on":
3+
push:
4+
branches:
5+
- develop
6+
7+
jobs:
8+
build_and_deploy_dev:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
actions: write
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v3
20+
21+
- name: Set up Docker Buildx
22+
uses: docker/setup-buildx-action@v3
23+
24+
- name: Login to Container Registry
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: set lower case owner name
32+
run: |
33+
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV}
34+
env:
35+
REPO: "${{ github.repository }}"
36+
37+
- name: Build and push
38+
uses: docker/build-push-action@v5
39+
with:
40+
context: .
41+
file: ./.docker/Dockerfile.dev
42+
platforms: linux/amd64,linux/arm64
43+
push: true
44+
tags: ghcr.io/${{ env.REPO_LC }}-dev:latest
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Build and Push Docker Image Production
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- closed
9+
10+
jobs:
11+
merge_and_publish_prod:
12+
runs-on: ubuntu-latest
13+
if: github.event.pull_request.merged == true &&
14+
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/'))
15+
permissions:
16+
contents: write
17+
packages: write
18+
actions: write
19+
pull-requests: write
20+
steps:
21+
- name: Extract version from branch name (for release branches)
22+
if: startsWith(github.event.pull_request.head.ref, 'release/')
23+
run: |
24+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
25+
VERSION=${BRANCH_NAME#release/}
26+
27+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
28+
29+
- name: Extract version from branch name (for hotfix branches)
30+
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
31+
run: |
32+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
33+
VERSION=${BRANCH_NAME#hotfix/}
34+
35+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
36+
37+
- name: Create Release
38+
uses: thomaseizinger/create-release@1.0.0
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
with:
42+
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
43+
tag_name: ${{ env.RELEASE_VERSION }}
44+
name: ${{ env.RELEASE_VERSION }}
45+
draft: false
46+
prerelease: false
47+
48+
- name: Merge main into dev branch
49+
uses: thomaseizinger/create-pull-request@1.0.0
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
with:
53+
head: main
54+
base: dev
55+
title: Merge main into dev branch
56+
body: |
57+
This PR merges the main branch back into dev.
58+
This happens to ensure that the updates that happend on the release branch, i.e. CHANGELOG and manifest updates are also present on the dev branch.
59+
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v3
65+
66+
- name: Set up Docker Buildx
67+
uses: docker/setup-buildx-action@v3
68+
69+
- name: Login to Container Registry
70+
uses: docker/login-action@v3
71+
with:
72+
registry: ghcr.io
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: set lower case owner name
77+
run: |
78+
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV}
79+
env:
80+
REPO: "${{ github.repository }}"
81+
82+
- name: Build and push
83+
uses: docker/build-push-action@v5
84+
with:
85+
context: .
86+
file: ./.docker/Dockerfile.prod
87+
platforms: linux/amd64,linux/arm64
88+
push: true
89+
tags: ghcr.io/${{ env.REPO_LC }}:${{ env.RELEASE_VERSION }}, ghcr.io/${{ env.REPO_LC }}:latest
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Build and Push Docker Image Staging
2+
"on":
3+
push:
4+
branches:
5+
- release/*
6+
- hotfix/*
7+
8+
jobs:
9+
build_and_deploy_stage:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
actions: write
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Extract branch name
20+
shell: bash
21+
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
22+
id: extract_branch
23+
24+
- name: Extract version from branch name (for release branches)
25+
if: startsWith(steps.extract_branch.outputs.branch, 'release/')
26+
run: |
27+
BRANCH_NAME="${{ steps.extract_branch.outputs.branch }}"
28+
VERSION=${BRANCH_NAME#release/}
29+
30+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
31+
32+
- name: Extract version from branch name (for hotfix branches)
33+
if: startsWith(steps.extract_branch.outputs.branch, 'hotfix/')
34+
run: |
35+
BRANCH_NAME="${{ steps.extract_branch.outputs.branch }}"
36+
VERSION=${BRANCH_NAME#hotfix/}
37+
38+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
39+
40+
- name: Set up QEMU
41+
uses: docker/setup-qemu-action@v3
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Login to Container Registry
47+
uses: docker/login-action@v3
48+
with:
49+
registry: ghcr.io
50+
username: ${{ github.actor }}
51+
password: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Set lower case owner name
54+
run: |
55+
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV}
56+
env:
57+
REPO: "${{ github.repository }}"
58+
59+
- name: Build and push
60+
uses: docker/build-push-action@v5
61+
with:
62+
context: .
63+
file: ./.docker/Dockerfile.stage
64+
platforms: linux/amd64,linux/arm64
65+
push: true
66+
tags: ghcr.io/${{ env.REPO_LC }}-stage:${{ env.RELEASE_VERSION }}-preview, ghcr.io/${{ env.REPO_LC }}-stage:lastest
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: "Draft New Release"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "The release version"
8+
required: true
9+
10+
jobs:
11+
draft_new_release:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
packages: write
16+
actions: write
17+
pull-requests: write
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Create release branch
23+
run: git checkout -b release/${{ github.event.inputs.version }}
24+
25+
- name: Update changelog
26+
uses: thomaseizinger/keep-a-changelog-new-release@1.1.0
27+
with:
28+
version: ${{ github.event.inputs.version }}
29+
30+
- name: Initialize mandatory git config
31+
run: |
32+
git config user.name "GitHub Actions"
33+
git config user.email noreply@github.com
34+
35+
- name: Bump version in package.json
36+
run: yarn version --new-version ${{ github.event.inputs.version }} --no-git-tag-version
37+
38+
- name: Commit changelog and manifest files
39+
id: make-commit
40+
run: |
41+
git add CHANGELOG.md package.json
42+
git commit --message "Prepare release ${{ github.event.inputs.version }}"
43+
44+
echo "::set-output name=commit::$(git rev-parse HEAD)"
45+
46+
- name: Push new branch
47+
run: git push origin release/${{ github.event.inputs.version }}
48+
49+
- name: Create pull request
50+
uses: thomaseizinger/create-pull-request@1.0.0
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
head: release/${{ github.event.inputs.version }}
55+
base: main
56+
title: Release version ${{ github.event.inputs.version }}
57+
reviewers: ${{ github.actor }}
58+
body: |
59+
Hi @${{ github.actor }}! 👋
60+
61+
This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}.
62+
I've updated the changelog and bumped the versions in the manifest files in this commit: ${{ steps.make-commit.outputs.commit }}.
63+
64+
Merging this PR will create a GitHub release and upload any assets that are created as part of the release build.
65+
66+
67+
build_and_deploy_stage:
68+
runs-on: ubuntu-latest
69+
permissions:
70+
contents: read
71+
packages: write
72+
actions: write
73+
steps:
74+
- name: Checkout code
75+
uses: actions/checkout@v4
76+
77+
- name: Extract version
78+
run: |
79+
VERSION=${{ github.event.inputs.version }}
80+
81+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
82+
83+
- name: Set up QEMU
84+
uses: docker/setup-qemu-action@v3
85+
86+
- name: Set up Docker Buildx
87+
uses: docker/setup-buildx-action@v3
88+
89+
- name: Login to Container Registry
90+
uses: docker/login-action@v3
91+
with:
92+
registry: ghcr.io
93+
username: ${{ github.actor }}
94+
password: ${{ secrets.GITHUB_TOKEN }}
95+
96+
- name: Set lower case owner name
97+
run: |
98+
echo "REPO_LC=${REPO,,}" >>${GITHUB_ENV}
99+
env:
100+
REPO: "${{ github.repository }}"
101+
102+
- name: Build and push Version
103+
uses: docker/build-push-action@v5
104+
with:
105+
context: .
106+
file: ./Dockerfile
107+
platforms: linux/amd64,linux/arm64
108+
push: true
109+
tags: ghcr.io/${{ env.REPO_LC }}-stage:${{ env.RELEASE_VERSION }}-preview, ghcr.io/${{ env.REPO_LC }}-stage:lastest

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [v0.0.1] - 2024-05-26
11+
12+
### Changed
13+
14+
- Improve CI/CD pipeline
15+
16+
## [0.0.0] - 2024-05-22
17+
18+
### Added
19+
20+
- Initial release
21+
- Create "Page under construction" Page
22+
23+
[Unreleased]: https://github.com/SmartCityFlensburg/project-website/compare/v0.0.1...HEAD
24+
25+
[v0.0.1]: https://github.com/SmartCityFlensburg/project-website/compare/472d9c0...v0.0.1

0 commit comments

Comments
 (0)