open-redirect/.gitea/workflows/build.yaml
edraft 66702e2603
Some checks failed
Build on push / prepare (push) Successful in 5s
Build on push / build-api (push) Failing after 4s
Build on push / build-redirector (push) Failing after 5s
Build on push / build-web (push) Has been cancelled
New version format
2025-01-17 20:05:37 +01:00

128 lines
3.9 KiB
YAML

name: Build on push
run-name: Build on push
on:
push:
branches:
- master
jobs:
prepare:
runs-on: [runner]
container: git.sh-edraft.de/sh-edraft.de/act-runner:latest
outputs:
build_version: ${{ steps.prepare.outputs.build_version }}
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=$BUILD_VERSION" >> $GITHUB_OUTPUT
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV
- name: Create Git Tag for Build
run: |
git config user.name "ci"
git config user.email "dev@sh-edratf.de"
git tag ${{ env.BUILD_VERSION }}
git push origin ${{ env.BUILD_VERSION }}
- name: Save Version Info
run: |
echo "VERSION = \"${{ env.BUILD_VERSION }}\"" > api/version.py
build-api:
runs-on: [runner]
needs: [prepare]
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: Build docker
run: |
cd api
docker build -t git.sh-edraft.de/sh-edraft.de/open-redirect-api:${{ needs.prepare.outputs.build_version }} .
- 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-api:${{ needs.prepare.outputs.build_version }}
build-redirector:
runs-on: [runner]
needs: [prepare]
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: Build docker
run: |
cd api
docker build -f dockerfile_redirector -t git.sh-edraft.de/sh-edraft.de/open-redirect-redirector:${{ needs.prepare.outputs.build_version }} .
- 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:${{ needs.prepare.outputs.build_version }}
build-web:
runs-on: [runner]
needs: [prepare]
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: Prepare web build
run: |
cd web
npm ci
- name: Build web
run: |
cd web
npm run build
- name: Build docker
run: |
cd web
docker build -t git.sh-edraft.de/sh-edraft.de/open-redirect-web:${{ needs.prepare.outputs.build_version }} .
- 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-web:${{ needs.prepare.outputs.build_version }}