2025-01-04 14:00:01 +01:00
|
|
|
name: Build on push
|
|
|
|
run-name: Build on push
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
jobs:
|
2025-01-17 19:45:18 +01:00
|
|
|
prepare:
|
|
|
|
runs-on: [runner]
|
|
|
|
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
|
|
|
steps:
|
|
|
|
- name: Clone Repository
|
|
|
|
uses: https://github.com/actions/checkout@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Get Date and Build Number
|
|
|
|
run: |
|
|
|
|
DATE=$(date +'%Y.%m.%d')
|
|
|
|
git fetch --tags
|
|
|
|
TAG_COUNT=$(git tag -l "${DATE}.*" | wc -l)
|
|
|
|
BUILD_NUMBER=$(($TAG_COUNT + 1))
|
|
|
|
BUILD_VERSION="${DATE}.${BUILD_NUMBER}"
|
|
|
|
echo "$BUILD_VERSION" > version.txt
|
|
|
|
|
|
|
|
- name: Create Git Tag for Build
|
|
|
|
run: |
|
|
|
|
git config user.name "ci"
|
2025-01-18 14:57:28 +01:00
|
|
|
git config user.email "dev@sh-edraft.de"
|
2025-01-17 19:45:18 +01:00
|
|
|
git tag ${{ env.BUILD_VERSION }}
|
|
|
|
git push origin ${{ env.BUILD_VERSION }}
|
|
|
|
|
|
|
|
- name: Upload build version artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: version
|
|
|
|
path: version.txt
|
|
|
|
|
2025-01-04 14:00:01 +01:00
|
|
|
build-api:
|
|
|
|
runs-on: [runner]
|
2025-01-17 19:45:18 +01:00
|
|
|
needs: prepare
|
2025-01-04 14:04:56 +01:00
|
|
|
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
2025-01-04 14:00:01 +01:00
|
|
|
steps:
|
|
|
|
- name: Clone Repository
|
|
|
|
uses: https://github.com/actions/checkout@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
|
2025-01-17 19:45:18 +01:00
|
|
|
- name: Download build version artifact
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: version
|
|
|
|
|
2025-01-04 14:00:01 +01:00
|
|
|
- name: Build docker
|
|
|
|
run: |
|
2025-01-04 14:09:17 +01:00
|
|
|
cd api
|
2025-01-17 19:45:18 +01:00
|
|
|
echo "VERSION = \"$(cat version.txt)\"" > version.py
|
2025-01-04 14:09:17 +01:00
|
|
|
docker build -t git.sh-edraft.de/sh-edraft.de/open-redirect-api:$(cat ../version.txt) .
|
2025-01-04 14:00:01 +01:00
|
|
|
|
|
|
|
- name: Login to registry git.sh-edraft.de
|
|
|
|
uses: https://github.com/docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: git.sh-edraft.de
|
|
|
|
username: ${{ secrets.CI_USERNAME }}
|
|
|
|
password: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Push image
|
|
|
|
run: |
|
2025-01-04 14:04:56 +01:00
|
|
|
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-api:$(cat version.txt)
|
2025-01-17 19:45:18 +01:00
|
|
|
|
2025-01-10 12:27:12 +01:00
|
|
|
build-redirector:
|
|
|
|
runs-on: [runner]
|
2025-01-17 19:45:18 +01:00
|
|
|
needs: prepare
|
2025-01-10 12:27:12 +01:00
|
|
|
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
|
|
|
steps:
|
|
|
|
- name: Clone Repository
|
|
|
|
uses: https://github.com/actions/checkout@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
|
2025-01-17 19:45:18 +01:00
|
|
|
- name: Download build version artifact
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: version
|
|
|
|
|
2025-01-10 12:27:12 +01:00
|
|
|
- name: Build docker
|
|
|
|
run: |
|
|
|
|
cd api
|
|
|
|
docker build -f dockerfile_redirector -t git.sh-edraft.de/sh-edraft.de/open-redirect-redirector:$(cat ../version.txt) .
|
|
|
|
|
|
|
|
- name: Login to registry git.sh-edraft.de
|
|
|
|
uses: https://github.com/docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: git.sh-edraft.de
|
|
|
|
username: ${{ secrets.CI_USERNAME }}
|
|
|
|
password: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Push image
|
|
|
|
run: |
|
|
|
|
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-redirector:$(cat version.txt)
|
2025-01-04 14:00:01 +01:00
|
|
|
|
|
|
|
build-web:
|
|
|
|
runs-on: [runner]
|
2025-01-17 19:45:18 +01:00
|
|
|
needs: prepare
|
2025-01-04 14:04:56 +01:00
|
|
|
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
|
2025-01-04 14:00:01 +01:00
|
|
|
steps:
|
|
|
|
- name: Clone Repository
|
|
|
|
uses: https://github.com/actions/checkout@v3
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
|
2025-01-17 19:45:18 +01:00
|
|
|
- name: Download build version artifact
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: version
|
|
|
|
|
2025-01-04 14:00:01 +01:00
|
|
|
- name: Prepare web build
|
|
|
|
run: |
|
2025-01-04 14:09:17 +01:00
|
|
|
cd web
|
2025-01-04 14:00:01 +01:00
|
|
|
npm ci
|
|
|
|
|
|
|
|
- name: Build web
|
|
|
|
run: |
|
2025-01-04 14:09:17 +01:00
|
|
|
cd web
|
2025-01-04 14:00:01 +01:00
|
|
|
npm run build
|
|
|
|
|
|
|
|
- name: Build docker
|
|
|
|
run: |
|
2025-01-04 14:09:17 +01:00
|
|
|
cd web
|
|
|
|
docker build -t git.sh-edraft.de/sh-edraft.de/open-redirect-web:$(cat ../version.txt) .
|
2025-01-04 14:00:01 +01:00
|
|
|
|
|
|
|
- name: Login to registry git.sh-edraft.de
|
|
|
|
uses: https://github.com/docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: git.sh-edraft.de
|
|
|
|
username: ${{ secrets.CI_USERNAME }}
|
|
|
|
password: ${{ secrets.CI_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Push image
|
|
|
|
run: |
|
2025-01-04 14:04:56 +01:00
|
|
|
docker push git.sh-edraft.de/sh-edraft.de/open-redirect-web:$(cat version.txt)
|