The .internal registry domain is being retired; git.schweitz.net now serves the registry without SSO on /v2/. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
65 lines
1.9 KiB
YAML
65 lines
1.9 KiB
YAML
name: Build and Push API
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'api/v*'
|
|
|
|
env:
|
|
IMAGE_NAME: git.schweitz.net/jpmschweitzer/webber-api
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: |
|
|
# Extract version from api/v0.3.0 -> v0.3.0
|
|
VERSION="${{ github.ref_name }}"
|
|
VERSION="${VERSION#api/}"
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create Gitea Release
|
|
run: |
|
|
curl -sf -X POST \
|
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"tag_name": "${{ github.ref_name }}", "name": "API Release ${{ steps.version.outputs.version }}", "body": "Automated release for webber-api ${{ steps.version.outputs.version }}"}' \
|
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
needs: release
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: |
|
|
VERSION="${{ github.ref_name }}"
|
|
VERSION="${VERSION#api/}"
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Login to Gitea Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.schweitz.net
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ./webber-api
|
|
push: true
|
|
tags: |
|
|
${{ env.IMAGE_NAME }}:latest
|
|
${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}
|
|
|
|
- name: Trigger Watchtower update
|
|
if: success()
|
|
run: |
|
|
curl -sf -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \
|
|
http://watchtower:8080/v1/update
|