configure build
This commit is contained in:
58
.gitea/workflows/build.yaml
Normal file
58
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
name: Build app and image
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: generate tag
|
||||||
|
id: generate_tag
|
||||||
|
run: |
|
||||||
|
echo "Generating a unique tag for the image..."
|
||||||
|
echo " Repo: ${{ github.repository }}; Run ID: ${{ github.run_id }}"
|
||||||
|
PREFIX="gitea.controller.bittehackmichnicht.de/${{ github.repository }}/ptp-chat-frontend"
|
||||||
|
if [ "${{ github.event_name }}" = "schedule" ]; then
|
||||||
|
echo "Scheduled run detected, using date-based tag."
|
||||||
|
echo "VERSION=${{ github.run_id }}" >> $GITHUB_OUTPUT
|
||||||
|
echo "TAG=$PREFIX:$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "LATEST=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "VERSION=alpha.${{ github.run_id }}" >> $GITHUB_OUTPUT
|
||||||
|
if [ ${{ github.event_name }} = "workflow_dispatch" ]; then
|
||||||
|
echo "Manual run detected, also updating 'latest' tag."
|
||||||
|
echo "LATEST=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "LATEST=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo "TAG=$PREFIX:$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
- name: Create .npmrc
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.npm
|
||||||
|
echo "registry=https://gitea.controller.bittehackmichnicht.de/api/packages/${{ github.repository }}/npm/" > ~/.npmrc
|
||||||
|
echo "//gitea.controller.bittehackmichnicht.de/api/packages/${{ github.repository }}/npm/:_authToken=${{ secrets.REGISTRY_PAT }}" >> ~/.npmrc
|
||||||
|
- name: Build & publish npm package
|
||||||
|
env:
|
||||||
|
VERSION: ${{ steps.generate_tag.outputs.VERSION }}
|
||||||
|
run: |
|
||||||
|
npm version $VERSION --no-git-tag-version
|
||||||
|
npm run build
|
||||||
|
npm publish --registry https://gitea.controller.bittehackmichnicht.de/api/packages/${{ github.repository }}/npm/
|
||||||
|
- name: Build & publish image
|
||||||
|
env:
|
||||||
|
TAG: ${{ steps.generate_tag.outputs.TAG }}
|
||||||
|
LATEST: ${{ steps.generate_tag.outputs.LATEST }}
|
||||||
|
run: |
|
||||||
|
docker build -t $TAG .
|
||||||
|
echo ${{ secrets.REGISTRY_PAT }} | docker login gitea.controller.bittehackmichnicht.de -u ${{ github.actor }} --password-stdin
|
||||||
|
docker push $TAG
|
||||||
|
if [ "$LATEST" = "true" ]; then
|
||||||
|
docker tag $TAG gitea.controller.bittehackmichnicht.de/${{ github.repository }}/ptp-chat-frontend:latest
|
||||||
|
docker push gitea.controller.bittehackmichnicht.de/${{ github.repository }}/ptp-chat-frontend:latest
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user