Files
psalmtafel-webservice/.gitea/workflows/deploy.yaml
T

67 lines
1.8 KiB
YAML

name: Build, Package & Release Next.js
on:
push:
branches:
- main
jobs:
build-and-push:
name: Build & Push Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Read Version from package.json
id: get_version
run: |
VERSION=$(jq -r '.version' package.json)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: 172.17.0.1:3000
username: ${{ github.actor }}
password: ${{ secrets.GITEA_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
172.17.0.1:3000/${{ github.repository }}:v${{ env.VERSION }}
172.17.0.1:3000/${{ github.repository }}:latest
create-release:
name: Create Gitea Release
needs: build-and-push
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Read Version from package.json
id: get_version
run: |
VERSION=$(jq -r '.version' package.json)
echo "VERSION=$VERSION" >> $GITHUB_ENV
if [[ "$VERSION" == 0.* ]]; then
echo "PRERELEASE=true" >> $GITHUB_ENV
else
echo "PRERELEASE=false" >> $GITHUB_ENV
fi
- name: Create Release in Gitea
uses: gitea/release-action@v1
with:
state: "main"
tag: "v${{ env.VERSION }}"
name: "Release v${{ env.VERSION }}"
body: "Automated release for version v${{ env.VERSION }}"
prerelease: ${{ env.PRERELEASE == 'true' }}
env:
GITHUB_TOKEN: ${{ secrets.GITEA_TOKEN }}