Files
015/.gitea/workflows/publish.yaml

88 lines
3.2 KiB
YAML

name: Publish
on:
push:
tags:
- '*'
jobs:
build-app:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: fudaoyuanicu
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/metadata-action@v5
id: meta
with:
images: fudaoyuanicu/015-app
tags: |
type=semver,pattern={{version}}
type=raw,value=edge,enable=${{ contains(github.ref_name, '-') }}
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
- name: Set build time
id: build-time
run: |
echo "time=$(date +%s)" >> $GITHUB_OUTPUT
shell: bash
- name: build-app
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ gitea.ref_name || github.ref_name }}
BUILD_TIME=${{ steps.build-time.outputs.time }}
build-worker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: fudaoyuanicu
password: ${{ secrets.DOCKER_PASSWORD }}
- uses: docker/metadata-action@v5
id: meta
with:
images: fudaoyuanicu/015-worker
tags: |
type=semver,pattern={{version}}
type=raw,value=edge,enable=${{ contains(github.ref_name, '-') }}
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
- name: Set build time
id: build-time
run: |
echo "time=$(date +%s)" >> $GITHUB_OUTPUT
shell: bash
- name: build-worker
uses: docker/build-push-action@v5
with:
context: .
file: ./worker/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
runs-on: ubuntu-latest
needs: [build-app, build-worker]
if: ${{ !contains(github.ref_name, '-') }}
steps:
- name: Send deployment webhook
run: |
curl -X POST http://192.168.100.5:8364/v1/update \
-H "Content-Type: application/json" \
-H "Authorization: Bearer helloworld"