Skip to content

Commit 36e793c

Browse files
committed
Implement release process
Related to gardenlinux/glvd#186
1 parent 88fefde commit 36e793c

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

.github/workflows/release.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Release
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
contents: write
7+
packages: write
8+
9+
jobs:
10+
release:
11+
name: Create Release
12+
runs-on: ubuntu-latest
13+
env:
14+
IMAGE_NAME: ghcr.io/gardenlinux/glvd-postgres
15+
IMAGE_NAME_ORG: gardenlinux
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v5
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Determine Version to Release
24+
id: version
25+
run: echo "VERSION=$(date --utc +%Y.%m.%d)" >> $GITHUB_ENV
26+
27+
- name: Set Version
28+
run: echo $VERSION > version.txt
29+
30+
- name: Configure git
31+
run: |
32+
git config --global user.name "github-actions[bot]"
33+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
34+
35+
- name: Commit version.txt to branch
36+
run: |
37+
git checkout -b release-version-${VERSION}
38+
git add version.txt
39+
git commit -m "chore: set version to ${VERSION}"
40+
git tag $VERSION
41+
git push --tags origin release-version-${VERSION}
42+
43+
- name: Install qemu dependency for multi-arch build
44+
run: |
45+
sudo apt-get update
46+
sudo apt-get install -y qemu-user-static
47+
48+
- name: Build Image
49+
id: build_image
50+
uses: redhat-actions/buildah-build@v2
51+
with:
52+
image: ${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }}
53+
tags: ${{ env.VERSION }}
54+
platforms: linux/amd64, linux/arm64
55+
containerfiles: |
56+
./Containerfile
57+
58+
- name: Echo Outputs
59+
run: |
60+
echo "Image: ${{ steps.build_image.outputs.image }}"
61+
echo "Tags: ${{ steps.build_image.outputs.tags }}"
62+
echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}"
63+
64+
- name: Check images created
65+
run: buildah images | grep '${{ env.IMAGE_NAME }}'
66+
67+
- name: Check manifest
68+
run: |
69+
set -x
70+
buildah manifest inspect ${{ steps.build_image.outputs.image }}:${{ env.VERSION }}
71+
72+
- name: Push To ghcr.io
73+
id: push-to-ghcr
74+
uses: redhat-actions/push-to-registry@v2
75+
with:
76+
image: ${{ steps.build_image.outputs.image }}
77+
tags: ${{ steps.build_image.outputs.tags }}
78+
registry: ghcr.io
79+
username: ${{ github.actor }}
80+
password: ${{ secrets.GITHUB_TOKEN }}

Containerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-ins
55
echo 'CREATE EXTENSION IF NOT EXISTS debversion WITH SCHEMA public;' > /docker-entrypoint-initdb.d/create-extension.sql
66

77
ADD postgresql.conf /etc/postgresql/
8+
ADD version.txt /version.txt

version.txt

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

0 commit comments

Comments
 (0)